top | item 44101958

(no title)

metayrnc | 9 months ago

I like the final approach. What about

-def sayHi()

Or

def- sayHi()

I feel like having a minus communicates the intend of taking the declaration out of the public exports of a module.

discuss

order

amonks|9 months ago

There's some prior art here from Clojure, where defn- creates private definitions and defn public ones:

https://clojuredocs.org/clojure.core/defn-

In Clojure this isn't syntax per-se: defn- and defn are both normal identifiers and are defined in the standard library, but, still, I think it's useful precedent for helping us understand how other people have thought about the minus character.

munificent|9 months ago

That's clever way to think of "-". :) I'll think about that.

kzemek|9 months ago

It might be from me being so used to it, but I do like Elixir’s `def`/`defp` second best to Rust’s `pub`