Page #Commas

Commas in REBOL

In most areas, the comma has been a reserved character in REBOL - set aside for some mysterious potential future use. My suggestion for how to utilise the comma is based on usage in other languages - some similar in appearance to REBOL (like CSS), some not (Ruby, JavaScript): Introduce a comma! datatype. It'd be an any-word! value and could be most useful in dialect creation:

  1, word, here => [integer! comma! word! comma! word!]

In Ruby, commas are used to separate values in Arrays and pairs in Hashes, but are also used to bind both types where the bounding braces are omitted enabling Ruby 'dialects'

 read :url => 'some url', :method => 'get'

In REBOL dialects, the implied block could be a similarly employed technique to aid readability.

  pattern red, 0.0.255, green 1x2, 5, spaced

In CSS, commas are used to bind and separate:

  font: bold italic 1.2em/1.4 'Georgia','Times New Roman',serif;
  background: rgba(255,0,0,0.4) url('top image') repeat-x center top, url('bottom image') repeat-x center bottom;

Such freewheeling, inconsistent use of commas can still be intuitive, but not with any hard rules about what their syntactic role is, rather as a value in their own right with their own semantic presence.

pair 1.5 3, 7 pi, 1.7 infinity

Start || Index

comments powered by Disqus

Sunday, April 18th, 2021 | QM | Sign In or Sign Up | Wiki | Journal

Controller: wiki; Action: show