Can you show us `first-day-of-month` and `last-day-of-month`? Moritz is
right though: ClojureScripts data structures are immutable, but it doesn't
stop you from creating mutable stuff (as you're doing with `new`).


On 16 August 2014 18:01, Moritz Ulrich <[email protected]> wrote:

>
> Clojure(Script)s data structures are immutable. Clojure itself doesn't
> stop you from mutating anything - it even has special functions to
> handle this in cases of host-interop (aset, (set! (.-foo some-js-obj)
> 42), etc.).
>
> Why are you mutating `today' in `first-day-of-month' anyway?
>
> Paul Cowan <[email protected]> writes:
>
> > I have found unexpected behaviour when calling functions in
> clojurescritpt
> >
> > In the function below, I had to clone the dates or they came back
> mutated:
> >
> > (defn ical [data]
> >   (reify
> >     om/IDisplayName
> >       (display-name [_]
> >         (or (:react-name opts) "calendar"))
> >     om/IRender
> >       (render [this]
> >         (let [today (js/moment (new js/Date))
> >               first-day-of-month (first-day-of-month (.clone today))
> >               last-day-of-month (last-day-of-month (.clone today))]
> >
> > I realise the dates are mutable in javascript but I thought the
> compilation
> > took care of this type of thing for you?
> >
> > Cheers
> >
> > Paul Cowan
> >
> > Cutting-Edge Solutions (Scotland)
> >
> > blog:      http://thesoftwaresimpleton.com/
> > website: http://www.cuttingedgesolutionsscotland.com/
> >
> > --
> > Note that posts from new members are moderated - please be patient with
> your first post.
> > ---
> > You received this message because you are subscribed to the Google
> Groups "ClojureScript" group.
> > To unsubscribe from this group and stop receiving emails from it, send
> an email to [email protected].
> > To post to this group, send email to [email protected].
> > Visit this group at http://groups.google.com/group/clojurescript.
>
> --
> Moritz Ulrich
>

-- 
Note that posts from new members are moderated - please be patient with your 
first post.
--- 
You received this message because you are subscribed to the Google Groups 
"ClojureScript" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/clojurescript.

Reply via email to