Hacker News new | past | comments | ask | show | jobs | submit login

About getters.. are they foo? or ?foo ? The examples have it mixed, "Meet Rye" doc has it as ?foo



If you don't come from Rebol it would probably be weird to you that there are many specific word-types in Rye.

    name: Janko ; name: is a set-word - it binds value to a word
    ?print      ; ?print is a get-word - it get's value word is bound to in this case a print builtin function
    :age        ; left leaning set-word (this is get-word in Rebol)
    what?       ; just a regular word
    ...
name get's the value anyway, so we don't need to use ?name but if word is bound to a function just invoking a word will evaluate a function and if we want to return a funtion we use get-word. which has ? in front.

? at the end is just a regular word and a (currently accepted) naming convention where noun? means get-noun. so length? in instead of get-length etc.

Rebol used ? at the end convention for more things, a lot for boolean results, testing of types, like string? and positive? but also for lenght?

For booleans current Rye's naming convention is that we use is-adjective. Rebol used positive? to test if value is positive. We would in this way use is-positive.

The conventions might change if we see that there are ways that make more sense and are also consistent.


Thanks for the explanations. Indeed I don't come from Rebol and the conventions seem like a terra incognita, although I can sense a significant value in them.

From a past romance with Forth I see in general how concatenative languages seem to be underappreciated a bit




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: