On Wed, Dec 10, 2008 at 4:32 PM, Brian Will <[EMAIL PROTECTED]> wrote:
>
> A Java reference type is basically any type allocated on the heap. The
> four Clojure reference types are particular Java reference types. My
> complaint is this is exactly the sort of weirdness that causes
> learners to scratch their heads. Not the biggest issue, sure, but this
> sort of thing is nice to avoid when possible.
>
> While we're at it, aren't "Var" and "Ref" backwards? Currently, Refs
> are the things that get mutated in the normal course of a program
> while a Var is just a top-level holder which is rarely changed.
> Shouldn't the thing which is variable be the "Var" and the
> (relatively) fixed thing be the "Ref"? The root problem here, though,
> either way, is that "var" vs. "ref" makes a dubious semantic
> distinction between already overloaded general-use terms. Sadly, you
> see this a lot in naming because good naming is very often /freaking
> hard/.
>
> Again, not a big deal by itself, but if you never fix these mistakes,
> they just build and build until a whole bunch of names in your system
> become impenetrably meaningless to newcomers, like car and cdr, making
> the whole system needlessly hard to learn.
>
> I understand, though, that I'm uniquely obsessed with ease of
> learning. One thing I find very exciting about Clojure--and something
> which very few have noted--is that Clojure is a considerably easier
> Lisp to learn: easier than CL, certainly, but also even easier than
> Scheme. Hence my introduction: I wanted to distill that simple essence
> into something sequentially readable and easily digestible. While the
> language is still open for amendment, I hope Clojure takes some
> measures to preserve and optimize ease of learning. Ease of learning
> is a big part of what will give Clojure a chance that other Lisps
> never had to see wide adoption.
>

I don't think they are misnamed. Naming is hard, but Clojure does
decent job of it, and has lots of considered names. The real problem
is that there are only so many good names/words, and, if they have
been used before, people familiar with the old usage will have some
adjustment to do. 'Type allocated on the heap' is a semantic for
reference that doesn't deserve to stand forever.

All of the reference types can vary, and all are references in the
sense that they refer to something else, their value. Vars have an
historic tie-in to CL's dynamic variables, and when thread-locally
bound, have the closest semantics to ordinary variables in other
languages, supporting unmitigated set! Ref is short for transactional
reference, a mouthful, and tref, which wasn't any more immediately
meaningful than plain ref, and has a tie to ML's ref. Atoms and Agents
hint pretty well at their semantics, which still must be explained.

As far as the ease of learning, well, sometimes the easiest thing to
do is not discuss something until later, i.e. why talk about
thread-local binding and vars to a beginner?

The bottom line is that there won't be a one-to-one mapping for a
beginner since they are not likely to be coming from a language that
requires all mutation to be done via controlled locations, never mind
one with multiple semantics for such locations. It's simply going to
be something new to learn, with it's own nomenclature.

Ideally beginners should avoid all the reference types until they get
comfortable with FP.

Rich

--~--~---------~--~----~------------~-------~--~----~
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
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to