Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lit-words and reflexivity #1342

Closed
Siskin-Bot opened this issue Feb 15, 2020 · 0 comments
Closed

Lit-words and reflexivity #1342

Siskin-Bot opened this issue Feb 15, 2020 · 0 comments
Labels

Comments

@Siskin-Bot
Copy link
Collaborator

Submitted by: Ladislav

Rebol LOAD function does not handle some apostrophe-prefixed words like: '/ '< '> '<= '>= '<>

The string-conversion idioms below can be frequently seen as a solution e.g. for dialect parsing purposes.

Disadvantages:

  • the obvious disadvantage of the above approach is that it converts string to word, which is generally not recommended when the word is known in advance. (I have seen some quirks to occur just because a string is used)

Therefore, I proposed the conversion function below and the subsequent idioms.

Advantages:

  • the new idioms are more readable
  • the code is faster
  • we get rid of the above mentioned quirks

Nevertheless, the word conversion idioms, although sufficient for the main purpose, don't solve the LOAD/MOLD issue below, so the only "clean" solution may be to use e.g. the #[lit-word! ...] syntax, or something similar.

; string conversion idioms:
to-lit-word "/"
to-lit-word "<"
to-lit-word ">"
to-lit-word "<="
to-lit-word ">="
to-lit-word "<>"
; conversion function:
as-lit-word: func ['word [any-word!]] [to lit-word! word]
; idioms:
as-lit-word /
as-lit-word <
as-lit-word >
as-lit-word <=
as-lit-word >=
as-lit-word <>

; LOAD vs. MOLD/ALL problem
>> load mold/all reduce [as-lit-word <]
** Syntax error: invalid "word-lit" -- "'"
** Where: transcode either if load
** Near: (line 1) ['<]

Imported from: CureCode [ Version: alpha 94 Type: Issue Platform: All Category: Syntax Reproduce: Always Fixed-in:none ]
Imported from: metaeducation#1342

Comments:

Rebolbot commented on Nov 18, 2009:

Submitted by: BrianH

You are trying to do a function workaround for a syntax problem. If the special-case words like those listed above aren't being recognized as lit-words, then the syntax scanner needs fixing. The function you propose shouldn't be added - the syntax needs fixing to make the function irrelevant.

Changed to a syntax issue, about the lit-word syntax problem.


Rebolbot commented on Nov 18, 2009:

Submitted by: meijeru

See also tickets #1318, #1303, #1302.


Rebolbot commented on Feb 8, 2010:

Submitted by: BrianH

As of alpha 97 all of the special-cased words with < or > in them are also accepted as lit-words (see #1461). Once lit-word versions of the / words are fixed (see #1477) we can dismiss this ticket.


Rebolbot commented on Nov 4, 2010:

Submitted by: Ladislav

in the core-tests suite

Rebolbot added the Test.written on Jan 12, 2016


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants