Hi,

On 21 Jan., 14:00, kony <kulakow...@gmail.com> wrote:

> If we try to write:
>
> (defrecord Point [#^double x #^double y])
>
> then create them as follows:
>
> (Point. "sth")
>
> we've got
>
> java.lang.ClassCastException: java.lang.String cannot be cast to
> java.lang.Number (NO_SOURCE_FILE:0)
>
> and this is OK,
>
> but If we put:
>
> (defrecord vect2 [#^clojure.lang.IPersistentVector v])
>
> instantiaion by a string seems to be OK
>
> (vect2. "sth")
>
> is it a bug or a feature?

>From http://clojure.org/datatypes:

* fields can have type hints, and can be primitive
    * note that currently a type hint of a non-primitive type will not
be used to constrain the field type nor the constructor arg, but will
be used to optimize its use in the class methods
    * constraining the field type and constructor arg is planned

Sincerely
Meikel

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