News for hackers. Stuff that matters.
Re:Writing GUI Apps Using the Red Programming Language by shalabhc on Sunday December 24, 2017 @02:54PM (#16001032)
For language enthusiasts, here are some interesting features of Red (and Rebol):

- You can pass unevaluated expressions to functions, which can then choose to evaluate the expressions any way they want. This sounds similar to 'fexprs' in some lisps.

- Scoping is very 'flexible' - you can take a function body and evaluate it in another 'context' which provides different values for all the words in the body.

- Making mini dialects (DSLs) is supposed to be easy and seems very common. It uses the `parse` function, which is a dialect used to define dialects. The parsing model is PEG like. The `view/options` for instance is a dialect being used for defining the GUI in the linked post.

- Red/System is a dialect for system programming (C-level semantics, and performance)

Overall it's a very interesting language and very impressive that it's also compact - the binaries are ~1MB on each platform.

Re:Writing GUI Apps Using the Red Programming Language by 9214 on Sunday December 24, 2017 @03:17PM (#16001138)
To clarify:

- unevaluated expressions are called blocks, and with them the line between code and data blurs, since you can treat block as either one at any time (homoiconity);

- there're no scopes, only namespaces (contexts);

- yes, Parse is one of the Red's crown jewels, many people (and author of the article himself) treat it as some kind of "plain English regex", while in fact it's not limited only to string parsing, but can be applied to any other series-like value and code (i.e. blocks) itself, which allows for some cool metaprogramming tricks;

- R/S (without any optimization layers whatsoever) is 2-3 times slower than C.

Re:Writing GUI Apps Using the Red Programming Language by shalabhc on Sunday December 24, 2017 @05:11PM (#16001570)
Thanks for the clarifications.

> it's not limited only to string parsing, but can be applied to any other series-like value and code (i.e. blocks) itself

Sounds somewhat similar to OMeta (http://www.tinlizzie.org/ometa/) which can pattern match streams of objects.

With contexts it sounds like almost every word can be late bound? Also it seems blocks and contexts are decoupled which means you could evaluate multiple blocks from different parts of your program in the same context, or give each a unique context, etc?

Re:Writing GUI Apps Using the Red Programming Language by 9214 on Monday December 25, 2017 @12:23AM (#16002799)
Every word (the thing what author calls a "variable") has a binding. In short, it's a pointer to the namespace where value associated with that word resides.

Blocks can nest any other value, including words. At any point in runtime you can change this pointers (bound word to some value) for every word in a block or for separate words.

Re:Writing GUI Apps Using the Red Programming Language by greggirwin on Wednesday December 27, 2017 @06:52PM (#16019146)
You can pattern match streams of values, and those values can be any lexical form that Red supports.
Re:Writing GUI Apps Using the Red Programming Language by throwaway7645 on Sunday December 24, 2017 @08:21PM (#16002167)
I'm not sure how easy it is to do DSLs. You don't see this popup in the Red or Rebol docs for a reason. It is homoiconic like Lisp, so it should be feasible. I'd love to hear some of the core devs like doc respond.
Re:Writing GUI Apps Using the Red Programming Language by greggirwin on Wednesday December 27, 2017 @06:55PM (#16019169)
How hard it is all depends on the DSL. I just found another article on HN and whipped one up as an example. See: https://news.ycombinator.com/item?id=16010971

It's not black magic, by any means, but it's also not yet point and click. We'll build more tools, higher level pieces, and more in the future.

Re:Writing GUI Apps Using the Red Programming Language by 9214 on Monday December 25, 2017 @12:32AM (#16002818)
It might get hairy if DSL is non-trivial, IIRC Doc has plans to implement meta-DSL wrapper (a la Rascal) sometime after 1.0 launch to ease the process.
Re:Writing GUI Apps Using the Red Programming Language by throwaway7645 on Monday December 25, 2017 @10:39AM (#16004465)
I hope Red puts up a couple of really simple examples on how to build DSLs. It's one of the great things Red/Rebol has to offer, but it isn't obvious how to do it.
Re:Writing GUI Apps Using the Red Programming Language by 9214 on Monday December 25, 2017 @01:07PM (#16005071)
I guess you can start with [1] and ask people in community, there may be a couple of simple examples to show.

[1]: https://github.com/red/red/wiki/Red---Rebol-Dialects:--Selec...

Re:Writing GUI Apps Using the Red Programming Language by throwaway7645 on Monday December 25, 2017 @04:26PM (#16005781)
I've tried asking the community before and the response wasn't good. With that being said, the links you sent were pretty nice, so thank you!
Re:Writing GUI Apps Using the Red Programming Language by 9214 on Monday December 25, 2017 @04:40PM (#16005827)
You're welcome! I actually rather interested in DSL creation myself and want to dabble my feet in this topic sometime. And I also feel that creation of dialects is rather obscure art for old-timers, and that there's a need for learning material.

With that said, I would appreciate if you'd listed what would you like to see in "How to bake DSL with Parse" guide of some sort, that would be really helpful when the time will come for writing tutorials and documentation.

Re:Writing GUI Apps Using the Red Programming Language by throwaway7645 on Thursday December 28, 2017 @11:22AM (#16022927)
Sorry, I guess what I'm trying to say is I'm aware what a DSL is (like View dialect), but no clue how to start creating one other than it has something to do with blocks and Red's homoiconicity. There needs to be a specific spot on the documentation page that gives a good overview with simple examples and finally a more complicated one. In fact, I hope they do that with all the planned additions of erlang like concurrency...etc. You know what I mean?