salvador

joined 2 years ago
[โ€“] [email protected] -1 points 1 year ago

You're an idiot - you've wasted a decade

 

In a third-party project, in the models, I've encountered functions like this:

  def changeset(model \\ %__MODULE__{}, params) do
    model
    |> cast(params, @required_fields ++ @optional_fields)
    |> validate_required(@required_fields)
  end

How can a function have a default argument which is both a) first and b) followed by a mandatory one?

What's interesting, they work properly.

[โ€“] [email protected] 0 points 2 years ago* (last edited 2 years ago)

Europe and US like to accuse others of everything. But they, strangely, don't like to be accused themselves in anything