Live data from Hacker News

The Red Programming Language

red-lang.org

101–110 of 135 posts

Re: The Red Programming Language

#102

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.

Except in homoiconic languages, like Rebol/Red/Lisp, there is no (need for a) new syntax.

Re: The Red Programming Language

#103

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

Or in Red's case, Parse - https://www.red-lang.org/2013/11/041-introducing-parse.html

Re: The Red Programming Language

#104
post #98

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-…

It has been interesting to watch the Clojure community’s take on DSLs over time. Clojure is a Lisp, and Lisps are notorious for inventing DSLs, particularly after PG’s various papers promoted that as a superpower of sorts. Clojure has gone the other direction and, while it supports macros, it generally discourages their use unless you’ve tried everything else first. But it still encourages DSLs built from the native…

The discouragement of macros I think is a knee-jerk reaction. Build around data structures and functions first, and then use the thinnest macros around that can be quite maintainable.

Re: The Red Programming Language

#105

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 like the idea of DSL, but in real projects, I hate almost every DSL introduced by coworkers.

Because they are really really difficult to get right almost as difficult as building a new language. But when they work well they can be a real boost.

Re: The Red Programming Language

#106

Earlier quoted context omitted.

>This is like the only programming language I could never learn. Wait till you hear of Urbit and see this: https://developers.urbit.org/overview/nock

It's worth noting this work came from a prominent internet extremist. A generous interpretation would be that it is a high-effort troll.

It makes more sense (or helps you buy into the marketing, if you prefer) if you read the short story that Tlon took its name from.

Re: The Red Programming Language

#107

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…

The limitation with regex is that's it's context free, whereas a regular grammar is simpler and more powerful IMO.

Re: The Red Programming Language

#108
post #20

red was terrible in 2018, and its terrible now - just tried to compile hello world and it takes 36 seconds https://github.com/red/red/issues/5615

Go compiles massive codebases in that time. V can recompile itself probably 2-3x in that time. I don't take any new language seriously unless it's memory safe, free of UB, able to interoperate with what already exists including optional shared libraries (because static linking the world every time in everything is memory and disk wasteful), and assists formal proofs of correctness. Otherwise, what already exists seem…

If a language can’t use shared objects at all, it’s really not much use, is it? Almost all languages make use of at least the posix syscall interfaces provided by the OS, and some platforms don’t even allow you to roll your own syscalls, iirc.

In my eyes it’s more important that FFI be easy, automatic, and as efficient as possible. Go imposes a significant cost on FFI, for example, and many languages have typesystems that are very unfriendly to C ABI or basically require swig.

One thing I really appreciate about Lua is that I can write Lua interfaces for my classes and methods quite easily, and even use Lua as a garbage-collected allocator for native types. Automating the generation of Lua interfaces can easily be done natively with metaprogramming, without involving dependencies like swig. It’s so good that instead of feeling like you’re figuring it out on the Lua side, it’s as if Lua puts the host language first, Lua doesn’t even need to be the owner of the process. It is almost ideal other than the clumsy interface between the stack-like C side and tables, and the dynamic parameter lists.

For so many languages FFI is an afterthought at best.

Re: The Red Programming Language

#109

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.

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?

Re: The Red Programming Language

#110
post #89

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 heard that in Lisp every program becomes a DSL?

I wouldn't say that. It's just its trivial to make DSLs in languages like the various lisps (common lisp, racket, chez scheme...etc).

That's usually what people complain about (besides the parenthesis) in that it's easy to not be very disciplined.

Lisp is homoiconic, so there isn't really a distinction between programs and data. For example, a snippet of code like a for-loop iterating through a list is also a list that can be inspected and modified. Or something along those lines (there's an XKCD comic that captures the spirit where the person says "it's all CARs" as in lisp you can build everything from CAR, CDR, and CONS I think). You'll have to dig into that on your own. The terms are historically relevant, but seem antiquated now. I've never really understood macros (compile or runtime ones) all that well though, so hopefully someone else in the comics can clarify my mumbo jumbo.

https://www.explainxkcd.com/wiki/index.php/224:_Lisp

Post reply on HN