|
2021-04-10
| ||
| 10:36 | • Ticket [3551813fff] Use @ to report offset in binary scan status still Ope... artifact: 3a53142f5a user: q3cpma | |
|
2012-12-08
| ||
| 22:51 | • Ticket [3551813fff]: 4 changes artifact: 232d0e1c15 user: avl42 | |
| 18:08 | • Ticket [3551813fff]: 4 changes artifact: a16facbba0 user: stwo | |
|
2012-08-27
| ||
| 00:08 | • Ticket [3551813fff]: 4 changes artifact: 4690310dc0 user: dkf | |
|
2012-08-26
| ||
| 07:26 | • Ticket [3551813fff]: 4 changes artifact: ede515ac2e user: avl42 | |
|
2012-08-05
| ||
| 22:21 | • Ticket [3551813fff]: 4 changes artifact: 8ccbb202f4 user: stwo | |
| 15:12 | Initial implementation of frq [3551813], use @ to report offset in [binary scan]. check-in: 27834cfe28 user: stwo tags: stwo-dev86 | |
|
2012-07-30
| ||
| 17:09 | • Ticket [3551813fff] Use @ to report offset in binary scan status still Ope... artifact: 5d42469a29 user: dkf | |
| 12:52 | • Ticket [3551813fff]: 4 changes artifact: 8a4c72fb18 user: stwo | |
| 12:52 | • Add attachment patch-tests_binary_test to ticket [3551813fffffffff|3551... artifact: bbdab687c6 user: stwo | |
| 12:51 | • Ticket [3551813fff] Use @ to report offset in binary scan status still Ope... artifact: a6a37c2102 user: stwo | |
| 12:51 | • Add attachment patch-generic_tclBinary_c to ticket [3551813fffffffff|35... artifact: 5d3ddd0c59 user: stwo | |
| 05:51 | • New ticket [3551813fff] Use @ to report offset in binary scan. artifact: 032ff2d847 user: stwo | |
Use @ to report offset in [binary scan]
Open3551813fffffffffffffffffffffffffffffffffCreated 14 years agoUpdated 6 years ago
Descriptionplain2012-07-30 05:51:05
Currently, using @ without an index in [binary scan] is an error. The [binary scan] implementation can be easily modified to allow an @ without an index to report the 'current' offset, storing it in a variable, like with other format specifiers. This makes it easier to track the offset; it must currently be done manually. Attached is a patch for the code and a patch for some tests, for Tcl 8.5.12. If this is 'approved' then I'll write more tests, adjust the documentation and submit new patches.
stwoplain2012-07-30 12:51:06
File Added - 450116: patch-generic_tclBinary_c
stwoplain2012-07-30 12:52:05
File Added - 450117: patch-tests_binary_test
dkfplain2012-07-30 17:09:26
Seems like a reasonable idea. Not looked at the changes yet.
stwoplain2012-08-05 22:21:53
Development continues in the stwo-dev86 branch on core.tcl.tk.
avl42plain2012-08-26 07:26:40
I've just submitted a new TIP, where (among other things) I prefer a new character "p" to a no-count-@. Once the TIP shows up, please read and judge my reasoning (in section "rejected alternatives").
dkfplain2012-08-27 00:08:04
See TIP #410 http://tip.tcl.tk/410.html
stwoplain2012-12-08 18:08:48
The reasoning in tip 410 for not wanting to use "@" is: 'I consider a typo "@ 42 ..." to be common enough to not want to give it a new unexpected meaning and side-effect.' What sort of typo is "@ 42" and how would that be different from "p 42"? I like having "@" mean the same thing in [binary scan] and [binary format]; it's less work for my brain. I'd like to move forward with this. It's easy to do, makes sense and is useful. It's much more lightweight than anything tip'ed. And there is an implementation. :)
avl42plain2012-12-08 22:51:51
The difference between "@ 42" and "p 42": "@..." with a count requires only a value argument (namely the count), not a variable name. If a blank crept into it, it would merrily treat some value argument as a variable and write a value into it, before it stumbles over the numeric literal and throws an error. At the time of error thrown, some random variable is already overwritten. With "p 42", also an error would be thrown, but p would at least be given a variable name, to which a sane value is written, before the error get thrown on hitting blank 42. That's my reason. If it is entirely unconvincing for you, then so be it. I'd consider the feature added your way with only @ to be still an improvement over current state, but I do think that using a new "p" is still better.
q3cpmaplain2021-04-10 10:36:30
After making a patch using '>' instead of 'p' (as this match the use of a symbol for '@' better, in my opinion), I just noticed the existence of this TIP. Any updates on this?
Log in (anonymous is fine) to add a comment.
Attachments:
- patch-tests_binary_test [download] added by stwo on 2012-07-30 12:52:05. [details]
- patch-generic_tclBinary_c [download] added by stwo on 2012-07-30 12:51:06. [details]