[HN Gopher] Access Control Syntax
       ___________________________________________________________________
        
       Access Control Syntax
        
       Author : todsacerdoti
       Score  : 10 points
       Date   : 2025-05-26 21:07 UTC (1 hours ago)
        
 (HTM) web link (journal.stuffwithstuff.com)
 (TXT) w3m dump (journal.stuffwithstuff.com)
        
       | metayrnc wrote:
       | 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.
        
         | munificent wrote:
         | That's clever way to think of "-". :) I'll think about that.
        
           | kzemek wrote:
           | It might be from me being so used to it, but I do like
           | Elixir's `def`/`defp` second best to Rust's `pub`
        
         | amonks wrote:
         | 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.
        
       | jevndev wrote:
       | I've stumbled into this problem before while drafting a language
       | I want to make*. A lot of the design philosophy is "symbols for
       | language features" and as such import/export is handled by
       | `<~`and `~>`. An example of an exported function:
       | 
       | ``` <~ foo := (a: int) { a - 1 } ```
       | 
       | Then at the import site:
       | 
       | ``` ~> foo ```
       | 
       | * some day it'll totally for real make it off the page and into
       | an interpreter I'm sure :,)
        
       ___________________________________________________________________
       (page generated 2025-05-26 23:00 UTC)