logoalt Hacker News

cupofjoakimtoday at 11:15 AM2 repliesview on HN

Interesting. there are some parts i like a lot here, but two things that I really dislike syntax wise. One is the lean towards a chainable syntax - this has proven to a big footgun for many devs in both java streams and typescript, making it very easy to go from O(n) to O(2n). The other part i really dislike is the first argument principle noted. If i myself define `string_and_reverse` and I can call it both through `string_and_reverse(42)` and `42.string_and_reverse()` i could definitely see this leading to some very funky looking chaining.

Perhaps it's just one point from me - not liking chaining :D


Replies

xigoitoday at 2:14 PM

> i could definitely see this leading to some very funky looking chaining.

At least for me,

  thing
    .doThis()
    .thenDoThat()
    .andFinallyThis()
is much more readable than

  andFinallyThis(
    thenDoThat(
      doThis(thing)
    )
  )
show 1 reply
KolmogorovComptoday at 11:40 AM

> making it very easy to go from O(n) to O(2n)

Strictly speaking I assume everyone knows O(n) = O(2n) =O(kn) for k in R.

But I see your point. I assume any decent compiler would merge the loops though

show 2 replies