Hey, it is an extremely simplified example ;) Which is more readable in the long run?
(struct sprite ::foobar 98 ::hunta ::laser [5.5 3.3] 4.01 78) or (make-instance foobar :id 98 :mode ::hunta :weapon ::laser :position [5.5 3.3] :velocity 4.01) :targetid 78] With Spinoza the two are equivalent, just make-instance is more readable. make-instance is also programmer friendly. You don't need to memorize the layout of a complex set of properties (imagines a sub-subclass of this sprite both which add 3 properties). That's 13 properties you have to remember to type in the right order. Say you have several different kinds of sprites. With struct you would have to manually define the layout for each different kind of sprite you want to use (a lot of redundancy). That or you have to defstruct a struct with all the properties predetermined and create functions that create instances of the different types (then why not use defclass at that point ? ;) If you relied on struct and decide to change the properly layout you have to go modify all the places where you used struct. No so with make-instance. Anyways, this was a goal stated earlier. I wanted make-instance to have the readability of struct-map with the performance of struct. Cheers. --~--~---------~--~----~------------~-------~--~----~ 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 clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~----------~----~----~----~------~----~------~--~---