Live data from Hacker News

Why Language-Oriented Programming? Why Racket?

beautifulracket.com

111–115 of 115 posts

Re: Why Language-Oriented Programming? Why Racket?

#111

I hear this alot about Racket as if this is the value proposition and Racket stands alone with these features. Languages like Ruby are routinely used to build DSLs (RSpec, Rails, ServerSpec, Chef...etc). I would like to hear somebody address why Racket is superior to languages like Ruby for creating DSLs, because it for sure doesn't stand alone. Metaprogramming is a feature in a LOT of languages. I'm not arguing for…

The author acknowledges that other languages can be used for DSLs. He claims that Racket's hygienic macro system is the special feature that makes it superior for the task.

Re: Why Language-Oriented Programming? Why Racket?

#112
post #31

I'm currently browsing the list of languages made with racket (here http://docs.racket-lang.org/search/index.html?q=H%3A ) and it seems like most languages are just lisp variants. I suppose they were made for educational or fun purposes, but i wonder if i haven't missed something more deep as to why someone would want to reimplement a lisp in a lisp language.

I'd say most are racket variants - and that makes sense - the scribble lang (for documentation/documents) is a prime example of that kind of "tool" DSL, and "lazy" (as mentioned by another commenter) is another.

https://docs.racket-lang.org/scribble/getting-started.html

But there's also stuff like:

http://docs.racket-lang.org/sweet/index.html

And after a quick Google I found:

https://github.com/soegaard/minipascal

And there are of course things like:

https://docs.racket-lang.org/datalog/datalog.html

But I suppose that qualifiés as "lisp like"...

[ed: and the article mentions "brag" which I think would be odd to call "lisp like" : https://docs.racket-lang.org/datalog/datalog.html ]

Re: Why Language-Oriented Programming? Why Racket?

#113
post #89
post #75

Earlier quoted context omitted.

ok but then since lisp already has an extremely small syntax, why not simply define functions in the language rather than using the macro system ? Unless your goal is to be source compatible with another lisp variant, of course.

>why not simply define functions in the language rather than using the macro system? I don't know. Most examples I've seen from people extolling the virtues of lisp macros and metaprogramming wind up just generating more lisp code in the same language with the same syntax and semantics, so I don't know why you couldn't just use functions in that case. To be fair, I only have a surface understanding of one lisp varian…

Eager evaluation prevents many forms from being implemented at the function level. You can't for instance easily write a short-circuiting and() function in most languages, because arguments to a function are eagerly evaluated.

So given an and() function, you can't safely do "and(False, fire_missiles())", because the language will evaluate both arguments.

But an and!() macro could: macro expansion is essentially "lazy", in that it happens prior to the evaluation phase, so it can avoid evaluating any pieces of code it wants to, such that "and!(False, fire_missiles());" is perfectly safe, because our macro can stop expanding after "False" and thus fire_missiles() is never evaluated.

Incidentally, this is why at least some macro patterns are unnecessary in lazy languages like Haskell: you can write short-circuiting and() as a function there, because a function in Haskell only evaluates as much as is necessary (provided it's been written properly). Yet even there, Haskell still has support for macros and things like TemplateHaskell and so forth, because there's just some things you can't do solely with functions, like arbitrary syntax, language extensions, etc.

Re: Why Language-Oriented Programming? Why Racket?

#114

I hear this alot about Racket as if this is the value proposition and Racket stands alone with these features. Languages like Ruby are routinely used to build DSLs (RSpec, Rails, ServerSpec, Chef...etc). I would like to hear somebody address why Racket is superior to languages like Ruby for creating DSLs, because it for sure doesn't stand alone. Metaprogramming is a feature in a LOT of languages. I'm not arguing for…

In practice most Ruby "DSL"s are just regular libraries that you happen to be able to use without the familiar foo(bar) function call syntax. It's the difference between "Domain Specific Language" and "A Domain Specific Language", or embedded vs. hosted/standalone DSL's [0]. The value that Racket provides is facility in developing standalone languages, as opposed to the embedded DSL's that people make in Ruby.

To address the examples you gave, RSpec, Chef, etc., those literally ARE just using Ruby, no new syntax, no new semantics.

[0] https://www.quora.com/What-is-an-embedded-domain-specific-la...

Re: Why Language-Oriented Programming? Why Racket?

#115
post #86
post #81

Earlier quoted context omitted.

My guess is that you’re seeing popularity based selection bias at work: languages with more common features are easier to understand and gain popularity faster than truly bizarre and unique languages which are confusing to newcomers. These popular languages end up being the ones you see every day. I bet a true random sample of programming languages would be a lot weirder.

I'd love to see some examples.

Find the video '50 in 50' by Steele and Gabriel.

50 programming languages of the last 50 years, illustrated in 50 minutes. It includes all the popular languages, but also covers some truly weird ones.

Post reply on HN