3 ms·
I'm not familiar with Red, but my understanding of REBOL is that its main use case is writing domain-specific languages to do the actual work. I can think of m
by StevePerkins 12y ago
I'm not familiar with Red, but my understanding of REBOL is that its main use case is writing domain-specific languages to do the actual work. I can think of many domains in which you would want your DSL to include primitives/literals for files or network URL's.
Of course, if Red is not so much a DSL as it is a DSL-authoring language like REBOL, then I share your confusion. For a general purpose language, I'm not sure what the advantage would be of making those primitives/literals rather than components within the standard library.
- dockimbel 12y agoSame reason for Red aswell as for Rebol. There are many more primitive/literals like that, tuple! [1] for example is used to represent RGB colors (255.0.255), ipv4 addresses (192.168.0.1) or even version numbers (2.7.8). Time/Date [2][3] also are basic datatypes with proper literal form. From Rebol console (these types not yet all implemented in Red): >> red + blue == 255.0.255 >> 192.168.100.123 and 255.0.0.0 == 192.0.0.0 >> yesterday: now/date - 24:00 == 15-Nov-2014 >> in-one-year: now + 365 == 16-Nov-2015 >> yesterday < in-one-year == true Rebol provides around 55 datatypes, with a good part of them having a specific literal form. The standard library is actually built-in the language, through this rich set of datatypes (each datatype overloads the basic language functions and operators). You don't need to "import" any of it, it's right there, but almost transparent to the users. The footprint for that is small, the full uncompressed runtime in binary form is about 500KB only. This unusual (but very effective in practice) approach, is one of the features that got me hooked to Rebol in the first place, 15 years ago. [1] http://www.rebol.com/docs/core23/rebolcore-16.html#section-3.9 http://www.rebol.com/docs/core23/rebolcore-16.html#section-3... [2] http://www.rebol.com/docs/core23/rebolcore-16.html#section-3.2 http://www.rebol.com/docs/core23/rebolcore-16.html#section-3... [3] http://www.rebol.com/docs/core23/rebolcore-16.html#section-3.8 http://www.rebol.com/docs/core23/rebolcore-16.html#section-3...