Live data from Hacker News

The Earl Grey programming language

breuleux.github.io

61–70 of 137 posts

Re: The Earl Grey programming language

#61
post #15

fact(match) = 0 or 1 -> 1 n -> n * fact(n - 1) why not simply fact(0 or 1) -> 1 fact(n) -> n * fact(n - 1)

I think the first one is a single function that has pattern matching for the parameter while the second one is defining the function twice and relying on the language to call the right one based on the parameter. I think in Erlang the function identification is the name and the arity and this is as close I know of what you would like to have.

In haskell you can write exactly the following:

    fact 0 = 0
    fact 1 = 1
    fact n = n * fact (n-1)
It works as you would expect and really they aren't that dissimilar.

Re: The Earl Grey programming language

#62
post #45

Earlier quoted context omitted.

>we can never have too many programming languages to play around with. Wait until we start having legacy code in all those languages. >we use 30 different compile-to-js languages used in our projects(that are no longer being developed) and you have to maintain it.

Shouldn't the tech leads in that case be picking one well maintained variant, then?

With what crystal ball? If you pick based on history, since you kinda have to, then you pick a more mature (older) language. If you're not careful with that you pick languages just before they go obsolete.

(Like a company I know which picked VB 6 and still hasn't fully migrated away from it. The same company picked Microsoft's AJAX demo as a basis for a JS framework and is still developing that even though MS long since abandoned it. Would it be better to use jQuery, Angular, Ember, React, Riot, etc? Well, those are too new and untested. Very conservative leadership.)

Anyway CoffeeScript and JavaScript work well together and you might want your code to be in CoffeeScript but you have to use a library, say Ember (also a real project at a different company) which means certain improvements, bug fixes, etc. to Ember are done in JS. There's two. I'm sure you could easily end up with multiple libraries written in multiple compile-to-JS languages.

Long-term code maintainability is a bit of a hard problem. You probably need to be constantly refactoring, rewriting, and re-inventing so you don't have too much old code in play anyway. Maybe. What do I know?

Re: The Earl Grey programming language

#64
post #7

"Oh god, do we need another language that compiles to javascript?!" —Everyone, probably

Why not? Maybe most of us are not going to use it, but the free market of growing programming languages will have an overall positive effect by inspiring other langs, such as many features of ES6 being inspired by CoffeeScript et cetera. Competition is good, competition is creativity.

I like seeing the trends of what features show up frequently in new languages. These features manage to work their way into more popular languages, either as changes to existing ones like Java or C++11 or new languages like Swift and Go.

Re: The Earl Grey programming language

#65
post #15

fact(match) = 0 or 1 -> 1 n -> n * fact(n - 1) why not simply fact(0 or 1) -> 1 fact(n) -> n * fact(n - 1)

I think the first one is a single function that has pattern matching for the parameter while the second one is defining the function twice and relying on the language to call the right one based on the parameter. I think in Erlang the function identification is the name and the arity and this is as close I know of what you would like to have.

Erlang does it very much like GP's suggestion with the one downside of being 'noisy' with its punctuation (some might say 'clearer'):

  factorial(0) -> 1;
  factorial(N) -> N * factorial(N-1).

  factorial(Foo, 0) -> .. ;
  factorial(Foo, Bar) -> .. .
Semicolons separate partial definitions for a single function of a single arity, and periods end those definitions. Removing the punctuation might make parsing a bit more difficult (will there be more partial definitions?), so it's understandable to not offer it.

Re: The Earl Grey programming language

#66

Earlier quoted context omitted.

There's plenty of precedent. It's just rare for a reason. I'm not sure allowing slightly easier access to CSS syntax justifies it.

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?

Re: The Earl Grey programming language

#67
post #7

"Oh god, do we need another language that compiles to javascript?!" —Everyone, probably

There shall be no peace until every language compiles to Javascript.

Does a VM of a PC count as a JIT compiler? Can we compile VirtualBox to JS using one of those C->JS compilers? I'm sure we can come up with some stack of turtles here ...

Re: The Earl Grey programming language

#70
post #47

Am I the only one childish enough to ask for the language to be called Earl Grey Hot in honor of Star Trek?

This is also what I thought. I was disappointed to see no TNG references on the page.

We could always write a little utility in it called Engage to make things right.
Post reply on HN