Comments (8)
Another way the difference manifests:
$ cat demo2.tcl
puts [list {*}{foo\
bar}]
$ tclsh demo2.tcl
foo bar
$ jimsh demo2.tcl
{foo } bar
from jimtcl.
If you're interested, I've just pushed a number of tests for Tcl 8-compatible handling of line continuations to Picol's repo.
from jimtcl.
Thanks for the report. I was aware of this incompatibility with Tcl but I didn't see it as a significant feature. (i.e. I've never needed it). I would be happy to hear specific issues with this missing feature aside from simply incompatibility.
from jimtcl.
The issues I have seen come down to long string literals with meaningful whitespace being corrupted in code that otherwise works in Jim. The most common has probably been help messages displayed incorrectly when written like the one below.
puts stderr {Lorem ipsum dolor sit amet, consectetur\
adipiscing elit. Aenean non pharetra\
metus, vitae tristique sem. Praesent\
at sapien non nibh suscipit ultrices.}
Those are only an annoyance. More important, though far less common, have been problems with multiline regular expressions and document templates. For example,
if {[regexp {a very long regular expression split on a word\
boundary} $foo]} ...
set template {
...
<deeply>
<nested>
<tags foo="a" bar="b" \
baz="c">
%5$s
</tags>
...
}
from jimtcl.
Here, is a fix: https://gist.github.com/msteveb/bc468decd86293c185e498adff9a2199
But unfortunately it breaks line numbering:
source-1.2 ERR Line numbers after command with escaped newlines
At : stacktrace.test:53
Expected: 'stacktrace.test 43'
Got : 'stacktrace.test 41'
source-1.3 ERR Line numbers after string with newlines
At : stacktrace.test:56
Expected: 'stacktrace.test 47'
Got : 'stacktrace.test 45'
source-1.4 ERR Line numbers after string with escaped newlines
At : stacktrace.test:59
Expected: 'stacktrace.test 51'
Got : 'stacktrace.test 47'
stacktrace.test: Total 45 Passed 42 Skipped 0 Failed 3
I don't see any easy way around this. I prefer line numbering to be correct.
from jimtcl.
Thanks for the patch! Yes, I agree it's a bad regression. So far I've spent a couple of hours trying to hack up a solution localized to just ScriptObjAddTokens
and JimMakeScriptObj
. I see a way to do it by attaching metadata about the squashed newlines' offsets to the script object, but this solution would be cumbersome and ugly. An alternative is to refactor the parser. I'll get back to you if I implement either.
from jimtcl.
I wonder if this is also the root cause of the error I get whenever I break a long list of proc parameters into 2 lines, in version 0.79:
$ cat proc.tcl
proc p {a \
b} {
puts $b
}
p one two
$ ./jimsh proc.tcl
proc.tcl:1: Error: argument with no name
at file "proc.tcl", line 1
I run into that often, and it's annoying. I'm in the habit of doing it that way, from Tcl 8.x
Just now I did find that removing the backslash makes it work:
$ cat proc.tcl
proc p {a
b} {
puts $b
}
p one two
$ ./jimsh proc.tcl
two
Is that the same workaround y'all use? I wouldn't want any interp changes that break line numbering in stack dumps. The line numbering is one of THE MAJOR reasons I've adopted Jim across the board. Its absence in Tcl 8.x is simply ASTONISHING to me.
from jimtcl.
I agree regarding line numbers and I wouldn't want to give it up for this feature. If anyone implements an elegant solution to this, I'm happy to consider it. In the meantime, yes I simply remove the backslashes.
from jimtcl.
Related Issues (20)
- Appveyor build warnings HOT 2
- Bug in reference counting or garbage collection HOT 8
- regexp: end of word match is broken. HOT 1
- Buffer overflow when building jimtcl with jimtcl installed HOT 1
- Confusing error message from oo.tcl
- CRTSCTS: requires _GNU_SOURCE or _BSD_SOURCE HOT 3
- Bug in regexp library may lead to out-of-bounds read HOT 1
- vi key bindings in jimsh HOT 3
- file.test fail on 32 bit systems HOT 5
- Jimtcl 0.82 test failed on some architectures HOT 9
- strncasecmp and strcasecmp in jim-signal.c w/o strings.h include
- Some return values ignored HOT 1
- configure does not/wrongly detect missing zlib and openssl with diet libc HOT 1
- Commenting JIM_OPTIMIZATION Breaks Build
- Provide a way to pass arbitrary strings to executed commands (likely with TIP 424) HOT 3
- Constant comparison HOT 1
- Feature request: add umask (or os.umask) command HOT 2
- documentation syntax examples are different than actual results HOT 6
- timer-3.2 test failure when building with tcl on osx HOT 3
- $(...) vs [expr {...}] HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jimtcl.