r3wp [groups: 83 posts: 189283]
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

World: r3wp

[!REBOL3-OLD1]

Sunanda
31-Jul-2009
[16392]
It's R3 only
BrianH
31-Jul-2009
[16393]
You can't do QUOTE for words in R2, but it works for other types 
(including other word types).
Geomol
31-Jul-2009
[16394]
What's the need for QUOTE, when we have the get-word syntax?
BrianH
31-Jul-2009
[16395x5]
QUOTE is mezzanine, and in mostly for qoting function references 
and other active values in generated code.
Geomol, the reason that
>> 'a == to-word "a"
== false

is because == now takes into account the binding of the word. TO-WORD 
string generates unbound words. LOAD string generates words that 
are bound to the user context - console commands are loaded just 
like scripts.
>> 'a = use [a] ['a]
== true
>> 'a == use [a] ['a]
== false
If you want to take into account the binding of a word but not its 
type (equivalency within the word types), use EQUIV? (no operator 
for it).
>> equiv? 'a use [a] [/a]
== false
>> equiv? 'a /a
== true
Geomol
31-Jul-2009
[16400]
I see. Being a tad complex, I think.
BrianH
31-Jul-2009
[16401]
We completely revamped equivalence. There are 4 levels now. There 
was a big blog discussion about it.
Geomol
31-Jul-2009
[16402]
4 levels of equivalence, wow! Is that a record in computer languages? 
;-)
BrianH
31-Jul-2009
[16403x2]
Not even slightly - many languages have it much worse :)
Btw, if you want to get the value of the <> word, remember that the 
same value is also assigned to the != word:
>> same? get quote <> :!=
== true
Geomol
31-Jul-2009
[16405]
Yeah, I found !=. I guess, the :<> is a lexical bug?

(I'm still working on a deep test on the lexical analyzer and hope 
to send the result to Carl and the rest of the R3 developers in the 
near future.)
BrianH
31-Jul-2009
[16406]
Please add the bug (perhaps aas a wish) to CureCode. There are other 
unresolved lexical bugs there already (like #537).
Geomol
31-Jul-2009
[16407x2]
I'll handle it in my lex report. There are many problems with < and 
> in different combinations. I guess, it's because they clash with 
the tag! datatype. For example:

>> '<
** Syntax error: invalid "word-lit" -- "'"
while other operators work ok as lit-words:

>> '=
== =
BrianH
31-Jul-2009
[16409]
Any use of those words conflicts with the tag! syntax. The trick 
is to set priorities.
Geomol
31-Jul-2009
[16410]
No, the trick is to program the lexer correctly without bugs! ;-)
BrianH
31-Jul-2009
[16411x2]
The lexer is where the priorities are set. What you are talking about 
isn't bugs, it is preferences (and good ones at that).
Non-configurable preferences, mind you. They have to be set in the 
source of the lexer.
Geomol
31-Jul-2009
[16413]
Ok, I see it differently. If it's possible to make a lexer, that 
can cope with tags and lit-words and get-words like '< and :<, then 
I see it as bugs in the current implementation.
BrianH
31-Jul-2009
[16414x3]
You could see it either way. Those "bugs" are backwards compatible 
with R2. However, this is clearly related to bug#666 :)
I prefer to think of them as justifiable improvements :)
We take Wish tickets as seriously as Bug tickets. Whether it is a 
Wish or a Bug doesn't affect prioritization of ticket handling.
Geomol
31-Jul-2009
[16417]
Output from my work-in-progress lexer:

:>
Valid get-word: :>
'>
Valid lit-word: '>
<a>
Tag begin


Next it should get the whole tag and return that as a valid tag. 
I think, it's possible to make a lexer, that can handle all this 
correctly (as I see it).
BrianH
31-Jul-2009
[16418]
It all sounds doable so far. Please remember #537 in your proposal.
Geomol
31-Jul-2009
[16419]
Why would you write

a,


? Comma is not allowed in words. I wondered about this some months 
ago, like if Carl had some future idea for the use of comma!?
BrianH
31-Jul-2009
[16420]
I don't want to allow , in words, I want to have the word be recognized 
and then have the lexer complain about the , next time.
Sunanda
31-Jul-2009
[16421]
Try not to break things like:
>> url? *::,
== true
(It's not always as easy as it looks :-)
BrianH
31-Jul-2009
[16422]
Read the comments - this would be word-only. This is why I was so 
precise in the ticket, referring to TRANSCODE behavior.
Geomol
31-Jul-2009
[16423]
Brian, ah ok.


As : is not allowed in words, that url example should be ok. But 
I'm wondering, why comma isn't allowed in words, as point is.

>> a.: 1
== 1
>> a,: 1
** Syntax error: invalid "word" -- "a,:"


I don't see the reason, other than if Carl has some special future 
idea for comma.
BrianH
31-Jul-2009
[16424]
The comma is so bad syntactically that throwing an error every time 
someone tries to use it is considered a valuable feature.
Geomol
31-Jul-2009
[16425]
Or maybe because comma is used in many languages to separate arguments, 
and by not allowing comma in words, REBOL might be easier to read 
for everyone.
BrianH
31-Jul-2009
[16426]
Plus, having something as difficult-to-see as a comma in any syntax 
role is considered a bad thing. REBOL syntax didn't come out of nowhere 
- these choices were maade for good reasons. It's why we don't use 
periods as well.
Geomol
31-Jul-2009
[16427]
If you get it, like to describe in #537, what should this return 
then?

transcode "a,0"
BrianH
31-Jul-2009
[16428]
[a ",0"]
Steeve
31-Jul-2009
[16429]
period is usable
Geomol
31-Jul-2009
[16430]
and

reduce [a,0]
BrianH
31-Jul-2009
[16431x2]
Except in binary. TRANSCODE works on UTF-8 binaries now. I need to 
adjust that ticket accordingly.
Geomol, that reduce example uses TRANSCODE/all, not TRANSCODE.
Geomol
31-Jul-2009
[16433]
ok, I'm not too familar with transcode. Let me make another example. 
This works today:

>> load "a ,0"
== [a 0.0]

What should this return:

load "a,0"
BrianH
31-Jul-2009
[16434x2]
Sounds like it should return [a 0.0].
Steeve, a period is usable, but not used (in general). And the period 
being usable is likely why the comma is an error.
Geomol
31-Jul-2009
[16436]
Today it's an invalid word. You suggestion would turn something invalid 
into being valid.
Sunanda
31-Jul-2009
[16437]
comma can be _used_ in words, but not in words that have to be serialised 
and then reloaded

    to-word "a,"    ;; this works  
    == a,

    to-word ",a"   ;; there are some limits
    ** Syntax error: invalid character in: ",a"

Don't serialise and reload O:
    o: make object! reduce [to-set-word "a," 1]
    == make object! [
        a,: 1
    ]
Geomol
31-Jul-2009
[16438]
lol, good ones, Sunanda!
BrianH
31-Jul-2009
[16439]
Sunanda, TO-WORD "a," being allowed sounds like a bug. Report it.
Geomol
31-Jul-2009
[16440]
It's the general thing, we've talked a bit about before, that TO 
some datatype should put the result through LOAD or something, so 
valid REBOL comes out of it.
Sunanda
31-Jul-2009
[16441]
But it's R2 compatible :)

There are other edge cases -- Latin-1 chars that can be _in_ a word 
not not _start_ them, and do not serialise well.....I did a script 
and found them all once