import and require for consuming the fruits of defrecord

2015-10-27 Thread Matching Socks
A recent announcement of Clojure 1.8.0-beta2 mentioned an interesting 
enhancement,

  CLJ-1823 Document new :load-ns option to defrecord/deftype

which I think means that "import" will make a record type fully usable 
without an auxiliary "require".  This would be an improvement (for 
Clojure), but it's not the same solution as ClojureScript.

Is eventual convergence of Clojure and ClojureScript record 
require'ment/import'ation envisioned?

-- 
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.


Re: import and require for consuming the fruits of defrecord

2015-10-28 Thread Alex Miller
CLJ-1823 documents the change from CLJ-1208, which is really targeted at 
interop use cases where a record type will be imported and instantiated 
from Java.

The effect you mention is secondary and I would recommend that the bulk of 
the type you are using records, you should require the record ns and refer 
the constructor functions for use. In most cases, you do not need to import 
or refer to the class itself (in particular, I think it's a bad idea to use 
Java interop to construct record instances). The one place where it does 
commonly need an import is when you are using the record type to define 
cases for something like multimethods or protocol extensions. 

Because the new property is optional (and false by default), I would still 
recommend an explicit require to load the namespace before using the 
constructor functions.

I don't know of any discussions around this change re ClojureScript. Could 
you explain the portability issue you have in mind?


On Tuesday, October 27, 2015 at 7:09:43 PM UTC-5, Matching Socks wrote:
>
> A recent announcement of Clojure 1.8.0-beta2 mentioned an interesting 
> enhancement,
>
>   CLJ-1823 Document new :load-ns option to defrecord/deftype
>
> which I think means that "import" will make a record type fully usable 
> without an auxiliary "require".  This would be an improvement (for 
> Clojure), but it's not the same solution as ClojureScript.
>
> Is eventual convergence of Clojure and ClojureScript record 
> require'ment/import'ation envisioned?
>

-- 
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.