Readit News logoReadit News
kbp commented on Amber: Programming language compiled to Bash   amber-lang.com/... · Posted by u/weaksauce
kbp · 2 years ago
I'm not sure what you find incomprehensible about the first example. The syntax is pretty standard. The only exotic thing is `$`, which is basically just like putting brackets around the rest of the line. Here's the first example roughly translated to Python:

  def main():
      x = 2
      [x] = ["foo"]
      y = 3
      [y] = ["bar"]
      print(x + y)
Seems about the same level of comprehensibility to me. Is there anything in particular you find difficult to understand?

The second example is expanded out and not how a person would normally write it, but if you're familiar with the basic concepts it's using, it shows why it works very clearly; think of it like assembler.

kbp · 2 years ago
Er, actually

  x = 2
  x = "foo"
  [y] = [3]
  [y] = ["bar"]
Sorry, I didn't re-read the code before translating.

kbp commented on Amber: Programming language compiled to Bash   amber-lang.com/... · Posted by u/weaksauce
mort96 · 2 years ago
Haskell has got to be by far the least readable language in the world, all of that is incomprehensible
kbp · 2 years ago
I'm not sure what you find incomprehensible about the first example. The syntax is pretty standard. The only exotic thing is `$`, which is basically just like putting brackets around the rest of the line. Here's the first example roughly translated to Python:

  def main():
      x = 2
      [x] = ["foo"]
      y = 3
      [y] = ["bar"]
      print(x + y)
Seems about the same level of comprehensibility to me. Is there anything in particular you find difficult to understand?

The second example is expanded out and not how a person would normally write it, but if you're familiar with the basic concepts it's using, it shows why it works very clearly; think of it like assembler.

kbp commented on Amber: Programming language compiled to Bash   amber-lang.com/... · Posted by u/weaksauce
michaelmior · 2 years ago
I guess I haven't read enough Rust code to come across this patterns, but I don't think I particularly like it. Perhaps I would get used to it though :)
kbp · 2 years ago
It works the same way in Haskell, eg

  main = do
    let x = 2
    let x = "foo"
    y <- pure 3
    y <- pure "bar"
    putStrLn $ x ++ y
which is really the same as

  main =
    let x = 2
    in let x = "foo"
       in pure 3 >>= \y ->
                       pure "bar" >>= \y ->
                                        putStrLn $ x ++ y
So it works pretty naturally where each assignment is kind of like a new scope. If the type system is good, I don't think it really causes issues.

Deleted Comment

kbp commented on Why are so many young Americans adopting fake British accents?   theguardian.com/lifeandst... · Posted by u/isomorph
pjc50 · 3 years ago
Brits can occasionally run into this problem with US or Canadian place names that look like they ought to be of French origin, but really aren't pronounced that way. (someone else can provide examples)
kbp · 3 years ago
Surely not in Canada?
kbp commented on Why are so many young Americans adopting fake British accents?   theguardian.com/lifeandst... · Posted by u/isomorph
dctoedt · 3 years ago
> I think the average American doesn't / can't distinguish Michael Caine's Cockney accent and David Attenborough's RP.

You really think so? Maybe it's just me, but I can't imagine how anyone could mistake the two. (Possibly different people have different ears for accents.)

kbp · 3 years ago
I can hear them and tell that they're different accents, but I don't really distinguish them, I would call them both "British" and I wouldn't know which one's more posh.
kbp commented on Pipe Operator (|>) For JavaScript   github.com/tc39/proposal-... · Posted by u/nassimsoftware
8note · 3 years ago
Naming is hard because names are useful.

Getting rid of the name moves the hard problem, rather than solve it

kbp · 3 years ago
Usually that effort should go toward naming functions rather than their results, though, and if the functions have good names, the results don't need them. In this example, `other_function` could have been named `get_user_data`, `new_function` could have been called `extract_user_details`, whatever.

Once you have good function names, which you should generally be spending a lot more effort on than good local variable names, you won't find any value in adding variables like `var foo = get_foo()`.

u/kbp

KarmaCake day807October 19, 2016View Original