Live data from Hacker News

The Red Programming Language

red-lang.org

111–120 of 135 posts

Re: The Red Programming Language

#111

Earlier quoted context omitted.

TBH, I feel like regexes would be much easier to understand in a more literate form with standard syntax. Something like: user_part = re.repeat(re.alnum | re.chars(".-_+")) domain_segment = re.repeat(re.alnum) domain = re.list(domain_segment,separator=".",minimum=2) email_address = user_part + "@" + domain Where, in a real program, `domain` would be defined in a "standard library of constructions" that you can just i…

recommend you check out raku Grammars … https://docs.raku.org/language/grammars

There’s really nothing about this that couldn’t be expressed just as clearly in a more general API though, even in C, IMO. Building it into the syntax is a little weird to me.

Re: The Red Programming Language

#112
post #80
post #31

Earlier quoted context omitted.

No, an API uses existing rules, but a DSL uses its own ad hoc rules. GP is right. Don't make DSLs, make APIs, which are: * More composable * More reusable * More simple to reason about * More natively supported * More portable * More readable * More maintainable

An API creates its own ad hoc rules too. They just don't change the grammar. In languages where the grammar is sufficiently flexible, the distinction all but disappears, but even in languages where the grammar is rigid and API's stand out like a sore thumb, the API itself still creates a new rule-set that you need to learn. You can choose to not call that a new language all you want, but the cognitive load is still t…

An API (as people usually mean by it, anyway…) is really just a simple grammar for the creation and manipulation of objects in the system. Those objects still have types and properties just like any other object, but they tend to be implicit and unreliable. A good DSL is just a more abstract and implicitly verb-oriented API. For example, Lua DSLs can resemble something almost like a sort of typed or tagged DDL. Translating that into an “API” just adds more clumsy legwork to achieve the same outcome.

Re: The Red Programming Language

#113

Earlier quoted context omitted.

Kind of, except that a non-DSL API doesn't create any new syntax. Which means that you get to keep all sorts of quality-of-life tools like syntax highlighting and correctness checking in the editor, autoformatting, possibly some amount of linting, etc. A few years ago I revisited Racket after a long hiatus, and that was maybe the biggest thing I noticed. I really don't like syntax macros as much as I did back in the…

Even without the new spiffs, I still don't see the point of DSLs. From where I sit, I see exactly zero problems where I think that new syntax is what I need to be able to write a solution.

Any markup language is a DSL. Including HTML.

Netlists.

Makefiles.

And so on.

You really don't see the value of DSLs?

Re: The Red Programming Language

#114
post #109

Earlier quoted context omitted.

Even without the new spiffs, I still don't see the point of DSLs. From where I sit, I see exactly zero problems where I think that new syntax is what I need to be able to write a solution.

Lisps don't support OO, concurrency like Go, or type checking but you can write a DSLs for them. Not useful? How about a rules engine?

Lisps support OO like you wouldn’t believe: https://lispcookbook.github.io/cl-cookbook/clos.html

Re: The Red Programming Language

#115
post #80

Earlier quoted context omitted.

An API creates its own ad hoc rules too. They just don't change the grammar. In languages where the grammar is sufficiently flexible, the distinction all but disappears, but even in languages where the grammar is rigid and API's stand out like a sore thumb, the API itself still creates a new rule-set that you need to learn. You can choose to not call that a new language all you want, but the cognitive load is still t…

An API (as people usually mean by it, anyway…) is really just a simple grammar for the creation and manipulation of objects in the system. Those objects still have types and properties just like any other object, but they tend to be implicit and unreliable. A good DSL is just a more abstract and implicitly verb-oriented API. For example, Lua DSLs can resemble something almost like a sort of typed or tagged DDL. Trans…

Agreed - I was tempted to make the same claim that it is still a grammar, but decided against it as I suspected it'd get in the way of making the point. You're 100% right you can write a grammar for an API as well, or can consider the API definition it self as creating a grammar.

Re: The Red Programming Language

#116
post #27

Languages that encourage making DSLs are a two-edged sword. On the one hand, you get to make a language that is more clear and fine-tuned to your use-case. On the other, you have an ad-hoc language with no support that you have to maintain along with the documentation (considering that you can't expect anyone else to know the DSL ahead of time). As I've gotten older, I've determined that well-designed APIs in a well-…

An API is just as much a DSL.

A DSL is expected to add or break language rules. An API is not.

An API can be so complex as to be thought of as a DSL but that makes it bad.

Re: The Red Programming Language

#117

Earlier quoted context omitted.

TBH, I feel like regexes would be much easier to understand in a more literate form with standard syntax. Something like: user_part = re.repeat(re.alnum | re.chars(".-_+")) domain_segment = re.repeat(re.alnum) domain = re.list(domain_segment,separator=".",minimum=2) email_address = user_part + "@" + domain Where, in a real program, `domain` would be defined in a "standard library of constructions" that you can just i…

I don't quite understand where regex gets its reputation from. I think that once you remember the meaning of the operators, it's not too bad. (And the concise syntax is actually very helpful.) I get that the meaning of the operators is not clear unless you're already familiar with regex, but neither is the meaning of !, ?, %, &, |, ^, ~, &&, ||, >, *, //, &, ++ (prefix), ++ (postfix), and so on. You learn these becau…

Regex syntax helps you understand what a regex does, not necessarily why it does it.

You can't decompose it into parts, you can't give those parts human-friendly names, you can't re-use parts in other regexes, you can't (easily) write functions that return or manipulate regexes (like that "list with separator" function shown above).

Re: The Red Programming Language

#118
post #36
post #32

Earlier quoted context omitted.

For me, it even went off the rails before, when Nenad went to China because he was able to raise funds for the project. But he hadn't anticipated that he would be in charge and not the other way around. The situation seems to suit him perfectly. I don't think Red has any future at this point. In any case, the roadmap has always been stratospheric.

can you elaborate what you mean by not anticipating that he would be in charge? btw, i met him in beijing while he was there.

That he would not have been able to do what he hoped to do to meet other demands of his creditors. Pure speculation.

Re: The Red Programming Language

#119

Languages that encourage making DSLs are a two-edged sword. On the one hand, you get to make a language that is more clear and fine-tuned to your use-case. On the other, you have an ad-hoc language with no support that you have to maintain along with the documentation (considering that you can't expect anyone else to know the DSL ahead of time). As I've gotten older, I've determined that well-designed APIs in a well-…

I've been thinking about this a lot. DSLs solve an important problem, but they do it in the wrong direction.

It's impossible to write objective fact. Everything we write is subjected to the context it is expressed in, including the grammar that we use to write it. A DSL accommodates this by letting you make a new grammar on the fly. The trouble is, this doesn't help us get out of the context we are writing in already: it only lets us enter a new one that is nested inside.

So what if we could actually get out? What if we could write from outside of the context we are writing? That's the idea I'm working on. I think it's possible, but it's such an abstract idea that it's tricky to get a handle on.

Re: The Red Programming Language

#120
post #40

This is a successor to REBOL[0], designed by Carl Sassenrath[1] who designed the Amiga kernel. I've looked it a few times over the years. It's neat. I've never written a single line of it, though. [0] https://en.wikipedia.org/wiki/Rebol [1] https://en.wikipedia.org/wiki/Carl_Sassenrath

I don't remember how I found it, but REBOL was one of the first programming languages I learned around 25 years ago. Most of my personal projects are still written in it. I have yet to try converting anything to Red.

I remember first hearing about it on TechTv's The Screen Savers way back when I think. I'm pretty sure it was demoed on a segment at one point.
Post reply on HN