Live data from Hacker News

The Earl Grey programming language

breuleux.github.io

71–80 of 137 posts

Re: The Earl Grey programming language

#73
post #2

What was the inspiration to create yet another compile to JS language?

I guess I wanted macros and pattern matching without Lisp syntax, and I wanted to retain and use the JS/node ecosystem. There's also a few language features I couldn't find anywhere else that I wanted to try out (my % operator, ad hoc exception classes, some pattern matching features like coercion and "match" inside a pattern to define sub-patterns, the each operator, some features of the macro system that I have yet…

What does the % operator formally do? All I could find in the documentation was :

> Earl Grey's % operator can be used to easily build HTML, DOM, virtual DOM, and other things:

Re: The Earl Grey programming language

#74

Earlier quoted context omitted.

On the other hand, pinky fingers everywhere are collectively breathing sighs of relief from not having to push down the shift key nearly as often.

Don't pinky fingers press the hyphen key?

My ring finger does. Not sure which is more common.

Re: The Earl Grey programming language

#75

Earlier quoted context omitted.

I'd love to hear why people prefer underscores over hyphens. I think I grew out of syntax fanboy-ism, but C and python __private__, _special_variable are everything but readable to me. They break the visual line too much. Even historically it was a weird symbol, originally a line break that made it into non-space separator in PL/1, then almost everywhere. Before that it was pure formatting, a typewriter glyph to be o…

> I'd love to hear why people prefer underscores over hyphens. Because I like subtraction.

Just wondering though, how often do people write subtraction as "stuff-thing" instead of "stuff - thing"? I find myself typing the latter almost systemically, so hyphens never get in my way, but of course it's all too easy to be blind to the habits of others.

Re: The Earl Grey programming language

#76

Earlier quoted context omitted.

I'd love to hear why people prefer underscores over hyphens. I think I grew out of syntax fanboy-ism, but C and python __private__, _special_variable are everything but readable to me. They break the visual line too much. Even historically it was a weird symbol, originally a line break that made it into non-space separator in PL/1, then almost everywhere. Before that it was pure formatting, a typewriter glyph to be o…

> I'd love to hear why people prefer underscores over hyphens. Because I like subtraction.

But you don't like spaces in statements?

Re: The Earl Grey programming language

#77
post #57

The "fact(match)" is very strange. In Haskell you have "lambda-case" and in Ocaml you have "fun" as syntaxes to define lambdas that pattern-match on the argument. That said, I really like the inclusion of async and a DSL for documents. These two are things that benefit a lot from having language support.

"fact(match)" is just making use of a generic feature: the "match" keyword in a pattern dictates that the body defines a sequence of sub-patterns to match at that position. An argument uses pattern syntax, so it works there, but it works in other situations, for example this contrived example: f(x, y) = match x: {m, n} -> match m: n + y else -> m + n + y n -> n + y Can be rewritten: f(match x, y) = {match m, n} -> n…

Is there any other language that does this? For me the second example doesn't look better than the first one.

Re: The Earl Grey programming language

#78
post #32

Earlier quoted context omitted.

JS is the new JVM. Write once, run anywhere is still the dream, I'm glad new programming languages are taking advantage of JavaScript's versatility.

> Write once, run anywhere is still the dream More like "write once, run in the browser". I don't think most compile-to-js languages care too much about "anywhere", they are just trying to get nicer alternatives in what is basically a platform (the browser) closed to anything except JS.

JavaScript will run anywhere

Re: The Earl Grey programming language

#80
post #73

Earlier quoted context omitted.

I guess I wanted macros and pattern matching without Lisp syntax, and I wanted to retain and use the JS/node ecosystem. There's also a few language features I couldn't find anywhere else that I wanted to try out (my % operator, ad hoc exception classes, some pattern matching features like coercion and "match" inside a pattern to define sub-patterns, the each operator, some features of the macro system that I have yet…

What does the % operator formally do? All I could find in the documentation was : > Earl Grey's % operator can be used to easily build HTML, DOM, virtual DOM, and other things:

There are examples below that statement for common usage, but if you want a deeper understanding:

    tag.xyz %
       property = value
       child1
       child2
Will produce the data structure:

    {tags = {"tag", ".xyz"}
     props = {property = value}
     children = {child1, child2}}
as an instance of the ENode class. Then, transformer functions can process the data structure to generate HTML or other things, e.g.

    require: /html
    html(thing)
    ==> child1child2
Post reply on HN