REBOL 3.0

Comments on: Those tricky < and > characters

Carl Sassenrath, CTO
REBOL Technologies
6-Feb-2010 18:29 GMT

Article #0305
Main page || Index || Prior Article [0304] || Next Article [0306] || 3 Comments || Send feedback

A97 Fixes

Release A97 should fix most or all of these related issues. Please try it out.

In the REBOL lexicon, the < and > "arrow" characters are special, and must be scanned (lexically analyzed) in special ways.

To understand the situation, notice that arrows denote two datatypes, word! and tag!:

>> type? second [a < b]
== word!
>> type? second [a > b]
== word!
>> type? second [a <> b]
== word!
>> type? second [a <c> b]
== tag!

To avoid problems, we don't allow arrows to be part of most words. This avoids creating ambiguous lexical sequences such as:

a <c b d e>

Are those arrows as words or are they part of a tag?

To simplify such cases, we restrict the usage of arrows when used for words. We allow these words:

< <= << <> >> >= >

If you attempt to use arrows within words in general, you'll see an error:

>> a<
** Syntax error: invalid "word" -- "a<"
** Near: (line 1) a<

However, we do want to allow this common markup usage in a sensible way:

>> [<b>word</b>]
== [<b> word </b>]

So, that's even more tricky to scan.

Now, all this being said, we know there are a few minor bugs related to arrows in the scanner. They are listed in the R3 CureCode bug database, and they will be fixed.

For example, we need to allow lit-word quoting of arrow words:

>> if word = '< [...]
** Syntax error: invalid "word-lit" -- "'"
** Near: (line 1) if word = '< [...]

But, I simply wanted to point out this issue, so it is understood that arrows are not general-usage word characters.

3 Comments

Comments:

Brian Hawley
8-Feb-2010 0:15:42
As of alpha 97 the issues with arrow-based lit-words and get-words are fixed. Set-words are still a problem: See ticket #1478 for details.
Graham
15-Feb-2010 15:48:58
==> X

REBOL already has an index? function. Did you RTFM before complaining??

i-find: func [ series [series!] value [any-type!] /local pos ][ either pos: find series value [ index? pos ][none ]]

>> i-find "something" "thing" == 5

>> i-find "something" "nothing" == none

Oldes
16-Feb-2010 11:46:41
xRatio: Have you ever heard something about REBOL and dialects? Probably not because than you would not say something like: Forget almost all your "datatypes"

I really think that you completely misunderstand the philosophy of REBOL.

btw: do you know that in REBOL you can write something like:

>> head change find "123" "2" "4"
== "143"
or for newbies the same written as:
>> head (change (find "123" "2") "4")
== "143"
Which means, that we don't need index to be an integer! to make series related operations. That's also the reason why you must use head in my example... simply if you are wise, you can write your code without any index holding variables and necessary series related internal jumps.

Post a Comment:

You can post a comment here. Keep it on-topic.

Name:

Blog id:

R3-0305


Comment:


 Note: HTML tags allowed for: b i u li ol ul font span div a p br pre tt blockquote
 
 

This is a technical blog related to the above topic. We reserve the right to remove comments that are off-topic, irrelevant links, advertisements, spams, personal attacks, politics, religion, etc.

REBOL 3.0
Updated 28-Mar-2024 - Edit - Copyright REBOL Technologies - REBOL.net