• Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

World: r4wp

[!REBOL3] General discussion about REBOL 3

Andreas
25-Feb-2013
[1071]
I discovered some interesting PARSE functionality, which I have not 
known about before. TO and THRU with integer arguments seem to do 
absolute positioning:

>> parse "abcd" ["abc" to 2 "bcd"]
== true


Anyone seen this before? I added a CC ticket as a reminder to document 
it (http://issue.cc/r3/1964) -- if anyone knows about a place where 
this is documented already, I'd be happy about a pointer.
BrianH
25-Feb-2013
[1072]
Integers are rule modifiers, so to 2 doesn't actually do anything. 
In order for that to work you would have to use to quote 2.
Andreas
25-Feb-2013
[1073x2]
Please just check for yourself, it behaves as I describe it above 
:)
(And it does so in R2 as well, so I may have picked the wrong group.)
Ladislav
25-Feb-2013
[1075]
I suggest to put the documentation to


http://en.wikibooks.org/wiki/REBOL_Programming/Language_Features/Parse/Parse_expressions



taking into account that this article strives to be as complete as 
possible
BrianH
25-Feb-2013
[1076]
The main problem is that when you pass TO an invalud rule, PARSE 
doesn't complain, it just ignores the rule as if you didn't write 
it at all.
Andreas
25-Feb-2013
[1077]
Ladislav: thanks, forgot to list that. And it's at least a place 
where we can add it right away.
BrianH
25-Feb-2013
[1078]
I think we have a ticket about that TO error ignoring problem.
Andreas
25-Feb-2013
[1079]
Brian, it's not an error. TO/THRU support integers.
Rebolek
25-Feb-2013
[1080]
Andreas, you're right! That's a great feature!
BrianH
25-Feb-2013
[1081x2]
to [2] should work, to 2 shouldn't.
But when to 2 doesn't work, TO doesn't complain.
Rebolek
25-Feb-2013
[1083]
Why it shouldn't work? It's great.
Andreas
25-Feb-2013
[1084]
https://github.com/rebol/r3/blob/master/src/core/u-parse.c#L487
Rebolek
25-Feb-2013
[1085]
>> parse "abcdefgh" ["abc" to 2 p: (probe p)]
bcdefgh
== false

>> parse "abcdefgh" ["abc" to 7 p: (probe p)]
gh
== false
Maxim
25-Feb-2013
[1086]
Rebolek, unfortunatly, you are mis-using TO.   TO is a search.   
 what you are doing is supposed to be done with SKIP
BrianH
25-Feb-2013
[1087]
Is there a skip operation in PARSE?
Andreas
25-Feb-2013
[1088]
Maxim: SKIP does relative positioning, TO/THRU do absolute positioning.
BrianH
25-Feb-2013
[1089x2]
Well, that behavior seems like an undocumented feature. And a useful 
one :)
Wait, that's right, 2 skip, not skip 2.
Maxim
25-Feb-2013
[1091]
what? heh? yuk.  sorry, but how do I then search for integers?
BrianH
25-Feb-2013
[1092]
to [2]
Maxim
25-Feb-2013
[1093x2]
I find that becomes quite assymetric in use.  if TO is going to change 
behaviors... relative in some cases and absolute in others... using 
weird datatype conventions (which seem to be completely different 
from the rest) then I'd rather have a new Absolute keyword which 
works just like to on All datatypes.
just like TO 2 ,  but on All datatypes.
Andreas
25-Feb-2013
[1095]
Only what would `absolute #"a"` mean?
Gregg
25-Feb-2013
[1096]
Move to Parse if this applies to R2 as well.
Andreas
25-Feb-2013
[1097]
Applies to R2 as well, so let's move to "Parse".
AdrianS
25-Feb-2013
[1098]
Andreas, did you discover this by just playing with parse or did 
you read through the source? I wondering if there are other goodies 
in there.
Andreas
25-Feb-2013
[1099x2]
Reading the source.
But this was pretty much the first thing I started looking at, which 
already lead me down the rabbit hole of testing it in R2 and R3, 
looking for documentation, filing a documentation request against 
R3 and discovering and reporting a bug against R3 (and I'll probably 
continue down the hole and fix that bug). So I didn't get much further 
towards other goodies, yet :)
Scot
25-Feb-2013
[1101]
A worthwhile hole, me thinks.
Cyphre
26-Feb-2013
[1102]
Guys, was there any discussion about the COMPRESS/DECOMPRESS natives 
in R3? Do we really need these functions to use some 'custom' compression 
format that noone in the world uses and when it is based on zlib 
anyway? Wouldn't be better to change this in R3 and use for example 
ZIP format? What do you think?

I remember Carl saying the custom format is more efficient but I 
tried to compress couple binary or text files to compare with ZIPped 
results and I don't see any significant difference that would be 
worth the current format incompatibility.
Sunanda
26-Feb-2013
[1103]
Earlier discussion of COMPRESS vs Zlib.....Basically, the two are 
almost identical already, so it should not take much to make something 
that is compatible:
     http://curecode.org/rebol3/ticket.rsp?id=328
Henrik
26-Feb-2013
[1104]
I agree that it should be easily compatible with other compression 
formats, but it does not take much to make it compatible (can be 
done via a mezz).
Cyphre
26-Feb-2013
[1105x2]
Sunanda, thanks for the link.
Henrik, I was more thinking to rip the old zlib code out of Rebol 
and put there some more actual(or even smaller) implementation (latest 
zlib or miniz etc.)
Pekr
26-Feb-2013
[1107x2]
maybe, historically, also the licence was a problem? Remember, R3 
was not open-sourced back at that time ...
I am fully for new, more standard way. I e.g. did not like .RIP format. 
E.g. Winamp uses normal zip format for their skin modules, etc. I 
would like to just hit enter or double click, getting into the archive/package.
Henrik
26-Feb-2013
[1109x2]
Cyphre: that sounds fine to me.
Pekr, I don't think .RIP was meant for basic temporary compression, 
but a more fully fledged file format to store serialized REBOL data 
efficiently?
Pekr
26-Feb-2013
[1111x3]
Henrik - RIP was crap :-)
I would prefer my app being packaged in default zip anyday ...
For me it was just another way of reinventing the wheel, with almost 
no added value ...
Henrik
26-Feb-2013
[1114x2]
Pekr, I don't think it's the same thing, plain and simple.
Would you not want a single, universal way to store and retrieve 
application state from disk? ZIP does not do that.
Pekr
26-Feb-2013
[1116x2]
why not? Because you can just 'do the .rip? I would not mind do decompress 
%my-app.zip :-)
Well, then I am wrong, ok. Not sure .rip format was anything in common 
with app state serialisation. I thought it was just plain and simple 
packaging mechanism - having a header, and binary container for compressed 
app modules/scripts ...
Henrik
26-Feb-2013
[1118x2]
Zip does not manage bindings or words transparently. It's simply 
not the same thing.
(and if it turns out, that it was not the goal with .rip, then the 
goal should be changed to do this)
Pekr
26-Feb-2013
[1120]
Then we talk two different things though. But - don't push anything 
like .rip on me, just to package my app. I want more transparent 
way, a zip archive I can inspect in Total Commander, Windows Explorer, 
etc.