>
> I don't see how you could accidentally mistype it (never happened IME) or 
> the need for compiler aid


You wouldn't even know though: 

(ns ns1)
(def ^:pribate typo "typo")
(def ^:private correct "correct")
^:private (def misplaced1 "misplaced1")
(^:private def misplaced2 "misplaced2")

(ns ns2
    (:require [ns1 :as ns1]))
  
ns1/typo
;ns1/correct ; Throws proper not public compiler error
ns1/misplaced1
ns1/misplaced2
ns1/misplaced2

Because all wrong declarations of private are valid to the compiler.

Compiler auto injection on postfix magic I'm strongly opposed to


Me two, I'm more behind having a dedicated construct reserved for compiler 
directives which is not abusing the metadata feature, and thus could also 
be checked for valid syntax at compile time.

Something that could be used for type hints, private, dynamic, etc. instead 
of meta.

(def +private +dynamic wtv "some thing") ; compiles fine
(def +pribate wtv "some thing") ; Compile error, +pribate is not a valid 
compiler hint, did you mean +private?
(defn +private +dynamic wtvfn [] "some wtv thing returned") ; Compile error, 
fn can not be made dynamic.

Then annotations could be a user land feature, not something that is also 
used to give the compiler compile hints and configurations. Well, it would 
also be that for backwards compatibility, but alas.

Anyways, probably better things to do then implement such a feature, also 
maybe its a bad idea too.


On Wednesday, 28 February 2018 11:58:05 UTC-8, Leon Grapenthin wrote:
>
> The one issue with the lack of def- is the existence of defn-. If defn- 
> didn't exist, no one would ask for def-. I believe this is where the 
> "regret" comes from.
> The other issue with the lack of def- is that its annoying to type 
> ^:prviate. I don't see how you could accidentally mistype it (never 
> happened IME) or the need for compiler aid. 
> If beginners think that there is a magic postfix syntax, I don't see how 
> this is a problem. They are beginners and naturally there will be many 
> things that fail their intuition.
> Compiler auto injection on postfix magic I'm strongly opposed to.
>
> @Alex thanks for your long reply yesterday and the statistics! I'll get 
> back to that. 
>
>
> On Wednesday, February 28, 2018 at 8:06:51 PM UTC+1, Didier wrote:
>>
>> I think the issue is not with the lack of def-, but with the use of 
>> metadata for private, as well as the presence of defn-.
>>
>> Becauae defn- exists, most newcomers think that postfix - on var defining 
>> special forms, macros and fns is how you mark things as private.
>>
>> But its not, defn- is a syntactic hack.
>>
>> The compiler and runtime looks for the private metadata on the Var for 
>> that. But metadata is easy to typo and always confusing as to where it 
>> needs to be inserted.
>>
>> Not sure there's a solution. Maybe reserved meta could be turned into a 
>> different syntax of reserved keywords which the compiler could validate if 
>> its misplaced or mistyped? Or postfix - on any first symbol in a form could 
>> be special syntax where the compiler auto-injects the private meta on the 
>> returned Var.
>>
>>

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to