ref & out parameters are not handled yet.  This is one of four CLR
interop problems waiting for solutions.  See the CLR Interop page on
the wiki for the others.

Three of the four, including this one, have fairly simple solutions at
the interop interface, but require some extension to Clojure to create
a good solution for the Clojure programmer.  Hence, input from
Clojurians and ultimately a blessing from the chief are requested/
required.

For ref & out parameters, the problem is that let bindings and fn
parameters are not variables.  You can't change the values they are
bound to.  ref and out change the values bound to the variables passed
as parameters.

So if we implement ref/out silently,

(let [ a nil ]  ...   (DateTime.TryParse  "2009/10/20" a) ... )

where subsequent to the call the value bound to a has changed, then
we've just changed Clojure semantics non-trivially.

Anything that introduces (let, fn) or changes (recur) a local name/
value binding at the moment is a special form, or a macro that
ultimately expands to a special form.  Do we need something equivalent
here?

I don't have enough use cases to make a design decision here.

Suggestions welcome.



On Nov 2, 1:38 am, Miron Brezuleanu <mbr...@gmail.com> wrote:
> Hello,
>
> One question about CLR interop: what is the correct way to handle
> 'out' parameters in Clojure code? The following doesn't work:
>
> Clojure 1.1.0-alpha-SNAPSHOT
> user=> (def a (DateTime.))
> #'user/a
> user=> (DateTime/TryParse "2009/10/20" a)
> True
> user=> a
> 1/1/0001 12:00:00 AM
> user=>
>
> I guess TryParse creates another instance of a DateTime, and the
> instance passed via 'a' is left unmodified.
>
> I believe the same problem applies to 'ref' parameters.
>
> Thanks,
> --
> Miron Brezuleanu
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to