The Earl Grey programming language
81–90 of 137 posts
Re: The Earl Grey programming language
#82Earlier quoted context omitted.
"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
#83Re: The Earl Grey programming language
#84Earlier quoted context omitted.
> 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
#85Earlier quoted context omitted.
God damn it how did I miss that. The condition was wrong, too. Fixed, thanks :)
Why not have a "Show HN" if you're the one who made it (assuming from the URL)?
Re: The Earl Grey programming language
#86Earlier quoted context omitted.
"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.
Ruby, dart, coffescript allow setting of instance variables from the parameter list:
class Example
constructor: (@name) ->
# do stuff
class Example
constructor: (name) ->
@name = name
# do stuff
Jonathan Blow's language allows the `using` keyword in parameter list, which desugars in much the same way.I'm personally not a big fan of using this technique for pattern matching, but its better than requiring explicit match blocks everywhere (like Scala and rust).
Re: The Earl Grey programming language
#87Earlier quoted context omitted.
> 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.
Something like:
result = balance-sheet - ledger-total + discount-total
Is harder to read than result = balanceSheet - ledgerTotal + discountTotalRe: The Earl Grey programming language
#88Earlier quoted context omitted.
> 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.
This code example doesn’t actually have any examples of unspaced subtraction in it, but there are a bunch of other binary operators with space removed. In my opinion adding spaces around all the operators in this file would make the code less readable, especially if trying to follow along from the formal published spec describing the algorithm: https://github.com/jrus/chromatist/blob/master/src/ciecam.co...
Re: The Earl Grey programming language
#89Re: The Earl Grey programming language
#90Earlier quoted context omitted.
> 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.
A search on github etc might give some idea of how common it really is - though their search wasn't precise enough last time I tried. Google code was (regex) but I think they closed down? Or you could just clone a few of your favorite projects and grep it.