logoalt Hacker News

shevy-javayesterday at 8:18 PM3 repliesview on HN

Guys,

I am sorry for your loss here.

    def example(x) when not is_map_key(x, :foo)
I think this also shows that merely copy/pasting ruby's syntax, isn't an automatic win. I noticed this before with crystal, though naturally crystal had types from the get go.

Fundamentally:

   def foo()
   end
should stay simple. And this is no longer the case now.

(Ruby also went in error, e. g. "endless methods". I don't understand why programming languages tend to go over the edge in the last 5 years or so.)


Replies

josevalimyesterday at 8:27 PM

The syntax you are commenting on has always existed in Elixir, before v1.0, as part of patterns and guards.

You are commenting as if we added this now but we have made no changes to the language surface. The difference is that we now leverage these same language constructs to extract precise type information.

andy_pppyesterday at 8:21 PM

You can of course still do the second thing, the types are not forced if you don't want them!