Re: Clojure.org: Concurrency screencast 404
That's the one I was looking for. Thanks! Is there a place I can file this as an issue so that the website points to the right one? On Tue, Dec 17, 2013 at 1:48 AM, Alex Miller a...@puredanger.com wrote: blip.tv killed the Clojure account. Many of the videos were moved to YouTube under the ClojureTV account: http://www.youtube.com/user/ClojureTV I suspect this is the talk you're referring to: http://www.youtube.com/watch?v=dGVqrGmwOAw On Monday, December 16, 2013 2:44:53 AM UTC-6, Abhijith wrote: Hello, Concurrency screencast link to blip.tv is throwing a 404. Is this a temporary thing or has it moved permanently? Most of this is covered in more detail in the concurrency screencasthttp://blip.tv/file/812787 . -- Queer little twists and quirks go into the making of an individual. To suppress them all and follow clock and calendar and creed until the individual is lost in the neutral gray of the host is to be less than true to our inheritance Life, that gorgeous quality of life, is not accomplished by following another man's rules. It is true we have the same hungers and same thirsts, but they are for different things and in different ways and in different seasons Lay down your own day, follow it to its noon, your own noon, or you will sit in an outer hall listening to the chimes but never reaching high enough to strike your own. - Angelo Patri -- -- 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/groups/opt_out. -- Queer little twists and quirks go into the making of an individual. To suppress them all and follow clock and calendar and creed until the individual is lost in the neutral gray of the host is to be less than true to our inheritance Life, that gorgeous quality of life, is not accomplished by following another man's rules. It is true we have the same hungers and same thirsts, but they are for different things and in different ways and in different seasons Lay down your own day, follow it to its noon, your own noon, or you will sit in an outer hall listening to the chimes but never reaching high enough to strike your own. - Angelo Patri -- -- 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/groups/opt_out.
Re: [ANN] Reagi 0.7.0 with ClojureScript support
Reagi's event streams are not dissimilar to Clojure's seqs, in that while their content may come from a side-effectful source, seqs and streams themselves are immutable. It therefore doesn't make a lot of sense to add an protocol for back-door mutation - in fact, excluding this was a deliberate design decision. May I ask in what context you found yourself wanting mutation? There might be a better way of achieving what you want. - James On 26 December 2013 07:35, Ruslan Prokopchuk fer.ob...@gmail.com wrote: I've just posted pull request to make streams pluggable, allowing to plug another stream as source to current. What are caveats of doing things in such way? I ask this question in general, not only as related to reagi functionality. May be it makes streams too mutable? четверг, 26 декабря 2013 г., 1:15:57 UTC+2 пользователь James Reeves написал: Happy Holidays and Merry Christmas, Reagi 0.7.0 has been released, now with support for ClojureScript. Reagi is an FRP library that introduces two new reference types: behaviors and event streams. Behaviors model continuous change, and work a little like delays, while events represent discrete changes, and work a little like promises. More information is available on the project page: https://github.com/weavejester/reagi It's my opinion that Reagi provides a very clean and idiomatic implementation of FRP for Clojure. It's only dependency is core.async, so it doesn't need to make the compromises that a wrapper of an existing Java or Javascript library might need. I've been using Reagi for Clojure for a while now, but the ClojureScript code is still rather new, and may exhibit problems I haven't anticipated. - James -- -- 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/groups/opt_out.
Re: Is Clojure right for me?
What sort of web development were you planning to do? - James On 25 December 2013 21:06, Massimiliano Tomassoli kiuhn...@gmail.comwrote: Hi, I'm not sure if Clojure is the right language for me. I'd like to use Clojure mainly for web development but I don't know if it's already mature enough to be productive. For instance, Scala has Play, Groovy has Grails, etc... If I'm not wrong, Clojure doesn't have a well-established framework for web development. I'm intrigued by Clojure because I like functional programming, but I need to be productive and, alas, I don't have time to learn Clojure just for my pleasure. -- -- 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/groups/opt_out. -- -- 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/groups/opt_out.
Re: Is Clojure right for me?
I'm still partial to Ring. On Thu, Dec 26, 2013 at 2:16 AM, James Reeves ja...@booleanknot.com wrote: What sort of web development were you planning to do? - James On 25 December 2013 21:06, Massimiliano Tomassoli kiuhn...@gmail.comwrote: Hi, I'm not sure if Clojure is the right language for me. I'd like to use Clojure mainly for web development but I don't know if it's already mature enough to be productive. For instance, Scala has Play, Groovy has Grails, etc... If I'm not wrong, Clojure doesn't have a well-established framework for web development. I'm intrigued by Clojure because I like functional programming, but I need to be productive and, alas, I don't have time to learn Clojure just for my pleasure. -- -- 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/groups/opt_out. -- -- 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/groups/opt_out. -- -- 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/groups/opt_out.
Re: [ANN] Reagi 0.7.0 with ClojureScript support
It was my fault to start discussion in two places, sorry for duplication. So, I suppose event buses is one of use cases for reagi's event streams. If I want to pass all data inside application through reagi/events and hold its state in them then ability to plug/unplug existing streams looks natural for me. But if you point me alternate solution for this case which emphasizes immutability, I will be happy. On Thursday, December 26, 2013 12:14:51 PM UTC+2, James Reeves wrote: Reagi's event streams are not dissimilar to Clojure's seqs, in that while their content may come from a side-effectful source, seqs and streams themselves are immutable. It therefore doesn't make a lot of sense to add an protocol for back-door mutation - in fact, excluding this was a deliberate design decision. May I ask in what context you found yourself wanting mutation? There might be a better way of achieving what you want. - James On 26 December 2013 07:35, Ruslan Prokopchuk fer@gmail.comjavascript: wrote: I've just posted pull request to make streams pluggable, allowing to plug another stream as source to current. What are caveats of doing things in such way? I ask this question in general, not only as related to reagi functionality. May be it makes streams too mutable? четверг, 26 декабря 2013 г., 1:15:57 UTC+2 пользователь James Reeves написал: Happy Holidays and Merry Christmas, Reagi 0.7.0 has been released, now with support for ClojureScript. Reagi is an FRP library that introduces two new reference types: behaviors and event streams. Behaviors model continuous change, and work a little like delays, while events represent discrete changes, and work a little like promises. More information is available on the project page: https://github.com/weavejester/reagi It's my opinion that Reagi provides a very clean and idiomatic implementation of FRP for Clojure. It's only dependency is core.async, so it doesn't need to make the compromises that a wrapper of an existing Java or Javascript library might need. I've been using Reagi for Clojure for a while now, but the ClojureScript code is still rather new, and may exhibit problems I haven't anticipated. - James -- -- 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/groups/opt_out.
Re: [ANN] Reagi 0.7.0 with ClojureScript support
Let's reduce duplication and discuss this issue solely on Github (for reference, https://github.com/weavejester/reagi/pull/3). I suspect there's another way of solving this, but I'll need to know more about the problem you have. - James On 26 December 2013 11:24, Ruslan Prokopchuk fer.ob...@gmail.com wrote: It was my fault to start discussion in two places, sorry for duplication. So, I suppose event buses is one of use cases for reagi's event streams. If I want to pass all data inside application through reagi/events and hold its state in them then ability to plug/unplug existing streams looks natural for me. But if you point me alternate solution for this case which emphasizes immutability, I will be happy. On Thursday, December 26, 2013 12:14:51 PM UTC+2, James Reeves wrote: Reagi's event streams are not dissimilar to Clojure's seqs, in that while their content may come from a side-effectful source, seqs and streams themselves are immutable. It therefore doesn't make a lot of sense to add an protocol for back-door mutation - in fact, excluding this was a deliberate design decision. May I ask in what context you found yourself wanting mutation? There might be a better way of achieving what you want. - James On 26 December 2013 07:35, Ruslan Prokopchuk fer@gmail.com wrote: I've just posted pull request to make streams pluggable, allowing to plug another stream as source to current. What are caveats of doing things in such way? I ask this question in general, not only as related to reagi functionality. May be it makes streams too mutable? четверг, 26 декабря 2013 г., 1:15:57 UTC+2 пользователь James Reeves написал: Happy Holidays and Merry Christmas, Reagi 0.7.0 has been released, now with support for ClojureScript. Reagi is an FRP library that introduces two new reference types: behaviors and event streams. Behaviors model continuous change, and work a little like delays, while events represent discrete changes, and work a little like promises. More information is available on the project page: https://github.com/weavejester/reagi It's my opinion that Reagi provides a very clean and idiomatic implementation of FRP for Clojure. It's only dependency is core.async, so it doesn't need to make the compromises that a wrapper of an existing Java or Javascript library might need. I've been using Reagi for Clojure for a while now, but the ClojureScript code is still rather new, and may exhibit problems I haven't anticipated. - James -- -- 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/groups/opt_out.
Re: How do I serve clojure pages with nginx
Here's an article I wrote that takes you through the full process of running nginx and and a Clojure web app. https://juxt.pro/articles/manual-clojure-deployment.html On Tuesday, December 17, 2013 12:44:34 PM UTC, Zeynel wrote: I've set up a home server with ubuntu and nginx and I can serve static pages. Now I want to add clojure but I am not sure what I need to do. I asked the same question in StackOverflow but for some reason it is voted to be closed: http://stackoverflow.com/questions/20632987/how-to-serve-clojure-pages-with-nginx Can you please direct me to documentation where I can read about this? Some issues that I don't understand are: how do I tell nginx that I am using clojure? Where do I install clojure, in the server? Where do I create the clojure files? Thanks. -- -- 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/groups/opt_out.
Re: Is Clojure right for me?
On 26 December 2013 12:24, Massimiliano Tomassoli kiuhn...@gmail.comwrote: On Thursday, December 26, 2013 11:16:07 AM UTC+1, James Reeves wrote: What sort of web development were you planning to do? I'd like to build websites. What kind depends on what my clients need. My recent Clojure web development has revolved around web services, either internally as part of a larger system, or as an external-facing API. Clojure is well-equipped in this area. I can offer less advice around the classic RoR use-case of a form-based website with a SQL back end. Most of the things I work on doesn't overlap much with that architecture. - James -- -- 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/groups/opt_out.
Re: Is Clojure right for me?
Hi Massimiliano. The absence of a well-established framework for web development in Clojure is not a sign of its immaturity (rather the opposite). Web frameworks can give you some increased productivity to begin with, but as soon as you need to do something that isn't naturally supported by your chosen web framework you're in trouble, and that's when productivity drops off a cliff as you struggle to bend the web framework to your requirements. For example, you choose a web framework with good REST support, then find out later you need to add web sockets. I've written and deployed about a dozen serious web applications using Clojure. My opinion is the best strategy that guarantees long-term productivity is to build your system from a set of smaller components that you choose 'a la carte'. That way, if your requirements change you can swap in and out other components as you need to. I would guess that the vast majority of Clojure web applications are written this way, which is why you don't see widescale adoption of a particular web 'framework' by the Clojure community. Instead, Clojure developers pick from a set of constituent parts: Jetty, http-kit, Ring, Compojure, Hiccup, Enlive, Stencil, Liberator, domina, dommy, C2, Om, shameless-plugbidi/shameless-plug, and so on and so on. The fact that these components all fit together so well is one of the truly outstanding features of the Clojure platform. Few languages come close to this level of integration, which is why they actively curate frameworks. Investing time in Clojure is both pleasurable and productive. It's a question of whether you want 'short-term' productivity to meet a particular project goal (choose a web framework), or sustainable productivity to deliver value to your users over the longer term (choose to learn, understand and utilize a set of components from the wide pool that the Clojure community has created). Regards, Malcolm On Wednesday, December 25, 2013 9:06:20 PM UTC, Massimiliano Tomassoli wrote: Hi, I'm not sure if Clojure is the right language for me. I'd like to use Clojure mainly for web development but I don't know if it's already mature enough to be productive. For instance, Scala has Play, Groovy has Grails, etc... If I'm not wrong, Clojure doesn't have a well-established framework for web development. I'm intrigued by Clojure because I like functional programming, but I need to be productive and, alas, I don't have time to learn Clojure just for my pleasure. -- -- 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/groups/opt_out.
Re: How do I serve clojure pages with nginx
java -jar is fine in production. Jetty, Tomcat, or Immutant will offer some conveniences but are not necessary. What is needed (for security reasons) is an nginx proxy. On Wednesday, December 25, 2013 3:42:00 AM UTC-8, Zeynel wrote: Ok, I worked through the tutorial referenced http://clojure-doc.org/articles/tutorials/basic_web_development.html#build-and-run-itand I created a jar file and ran it with $ java -jar -my-webapp.jar. This works. But my understanding is that this is would not work for production. I need to use nginx as proxy to jetty (or immutant?). I am trying to figure out the correct configuration for jetty and nginx. Each tutorial appears to be different and so far I couldn't make it work. On Friday, December 20, 2013 9:39:07 AM UTC-4, David Della Costa wrote: Hi Zeynel, I don't know if setting things up the way I've laid out there is such a great idea. What I would do instead is set the port and whatnot in the jetty configuration inside of ring, assuming that's what you're using (this assumes a lot about how your app is set up, so let me know if this doesn't match your setup): http://ring-clojure.github.io/ring/ring.adapter.jetty.html Then, I would compile an uberjar with lein, like so: $ lein uberjar In your startup script, as Curtis laid out, call the jar file using something like: /path/to/java -jar /path/to/uberjar That will be much simpler than what I have in my tutorial...which I should really update, now that you mention it! DD (2013/12/19 9:28), Zeynel wrote: I am following your tutorial, but I am stuck with Jetty configuration. My installation does not seem to have a /contexts directory. Where is it? On Tuesday, December 17, 2013 9:02:19 AM UTC-4, David Della Costa wrote: I have not done this specifically with Nginx but I suspect you probably want something like what I set up with Apache + Jetty: https://github.com/ddellacosta/Clojure-under-Jetty-and-Apache#setting-up-jetty-with-apache-httpd https://github.com/ddellacosta/Clojure-under-Jetty-and-Apache#setting-up-jetty-with-apache-httpd That is, set up Nginx to act as a proxy for Jetty: http://nginx.org/en/docs/beginners_guide.html#proxy http://nginx.org/en/docs/beginners_guide.html#proxy One difference with how I would do it these days (vs. what I wrote in the piece above) is that I would probably simply push out an uberjar with lein which I would run with Java via an init script--for example, if using Ubuntu: http://upstart.ubuntu.com/cookbook/#run-a-java-application http://upstart.ubuntu.com/cookbook/#run-a-java-application So, I would imagine the basic construction would be something like: ring app w/jetty or http-kit, packaged as an uberjar (lein uberjar), then set up to run via an init script (via upstart in your case) on an alternative port, which is proxied by Nginx as in the link above. Hope this helps-- DD (2013/12/17 21:44), Zeynel wrote: I've set up a home server with ubuntu and nginx and I can serve static pages. Now I want to add clojure but I am not sure what I need to do. I asked the same question in StackOverflow but for some reason it is voted to be closed: http://stackoverflow.com/questions/20632987/how-to-serve-clojure-pages-with-nginx http://stackoverflow.com/questions/20632987/how-to-serve-clojure-pages-with-nginx Can you please direct me to documentation where I can read about this? Some issues that I don't understand are: how do I tell nginx that I am using clojure? Where do I install clojure, in the server? Where do I create the clojure files? Thanks. -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clo...@googlegroups.com javascript: Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+u...@googlegroups.com javascript: For more options, visit this group at http://groups.google.com/group/clojure?hl=en 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+u...@googlegroups.com javascript:. For more options, visit https://groups.google.com/groups/opt_out https://groups.google.com/groups/opt_out. -- -- You received this message because you are subscribed
Re: [ANN] Clojure.Joda-Time 0.1.0
Thanks for sharing! It looks good, though can you explain the rationale for having a separate library? It seems from my perspective as if the objective of exposing all the good Joda functionality for Clojure consumption would be more readily achieved by extending the existing clj-time library. If there isn't a good technical reason, can I suggest rolling all the features into clj-time, rather than developing a new library? On Wednesday, 25 December 2013 11:19:18 UTC, dm3 wrote: Hello, I would like to announce the first release of Clojure.Joda-Timehttps://github.com/dm3/clojure.joda-time - an ambitiously named wrapper for the Joda-Time date and time library. Main goals of Clojure.Joda-Time: * Provide a consistent API for common operations with instants, date-times, periods, partials and intervals. * Provide an escape hatch from Joda types to clojure datastructures and back where possible. * Avoid reflective calls (this is a problem, because many types in Joda-Time have similar functionality hidden under similarly named and overloaded methods with no common interfaces). * Provide an entry point into Joda-Time by freeing the user from importing most of the Joda-Time classes. Compared to clj-time https://github.com/clj-time/clj-time, this library is not DateTime-centric. If you tend to use local dates in most of your projects, meaning you don't care about time zones, there's no purpose in using DateTime at all. You should be using various Partials provided by Joda-Time, most common being LocalDate and LocalDateTime. This also means that date-times created through Clojure.Joda-Time are not converted to the UTC timezone by default, as they are in clj-time. There's quite a comprehensive README on github: https://github.com/dm3/clojure.joda-time as well as the API-docs: http://dm3.github.io/clojure.joda-time/ This is pretty much an experiment, albeit a very elaborate one (and time consuming). Feel free to suggest improvements/rant about deficiencies :) Fun facts: * first release may be treated as a Christmas present * while testing the library with simple-check ~10 bugs were identified (most of them already fixed) in the Joda-Time itself * library contains an implementation partial intervals (e.g. interval of LocalDates) -- -- 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/groups/opt_out.
Re: Good resources on dataflow based programming
*Given an infinite number of cores, the time to process a set of dataflow functions is equivalent to the the time that the longest function took to do its processing.* It sounds like you've just discovered Amdahls Law :-D https://en.wikipedia.org/wiki/Amdahl%27s_law As for the articles, the hierarchies one is interesting to me mainly because a dataflow network is basically a flat hierarchy: the network will still run if you remove, exchange or add to parts of it. I noticed this a lot when I did some Max/MSP development and it changed how I approached problems. It was a very exploratory approach, but the difference to using a REPL is that its easy to change code deeply integrated in other code and re-evaluate whichever parts you want to test (actually, I do this in Clojure by evaluating my code from my editor rather than in a REPL, but it still feels different from rewiring a visual language). In Pedestal, you can see this when you remove, exchange or add, eg, transform functions - this does not affect the rest of the dataflow at all as they are independent and isolated. I find this a very powerful and pleasant way to program, which is why I linked that article. The other article obviously doesn't apply in pedestal-app's because javascript cannot run the code in parallel, but I found that conceptually it has helped me understand how and why to isolate code and how it all fits together. I also envision that the pedestal dataflow system will eventually become part of pedestal-service (they ported it to use core.async, I'm assuming this was to make this a possibility), in which case, it actually can run in parallel and pipelined. I hope the articles made things clearer and not more confusing! On 25 December 2013 02:40, Stephen Cagle same...@gmail.com wrote: Just a quick thought I had as I was walking home. Given an infinite number of cores, the time to process a set of dataflow functions is equivalent to the the time that the longest function took to do its processing. The efficiency is the (sum of time that all the dataflow functions took) / ( (count of the dataflow functions) * (the time of the longest running dataflow function) ). Given this, optimization is really simple. Take the longest running dataflow function, and see if you can somehow split it into smaller functions. Nothing profound here, but I thought it was interesting how evident optimizations might be when you use a dataflow processing model. On Tuesday, December 24, 2013 3:50:43 PM UTC-8, Stephen Cagle wrote: One thing that I am seeing on a re-read is that I conflated the notion of the data flow function and the paths. I was sort of thinking that the data flow functions sit at a particular path location. Similar to how a value sits in a location in memory. It is more appropriate to say that the data flow function is associated (referred isn't quite right) with a particular path location. Taking this a bit further, a data flow function DOES NOT actually know who its inputs are. It only knows that it takes input values in/of a certain form. The schema that specifies how one set of paths map to another path are possibly separate from the schema that specifies which dataflow function is associated with which path. On Tuesday, December 24, 2013 1:36:16 PM UTC-8, Stephen Cagle wrote: Thank you. I only read the last two articles so far; some notes. http://my.opera.com/Vorlath/blog/2008/01/06/simple- example-of-the-difference-between-imperative-functional-and-data-flow I realized that I really wasn't getting what dataflow was about. I was viewing dataflow paths as a sort of hook that I could hang values on. I had never externalized the fact that each path only refers to the things it inputs upon. Specifically, I was modeling some of the patterns like path A passes a value to B, B does some computation, and puts the result on path A. This isn't neccessarily wrong, but it appears that I was using dataflow paths in a way similar to function evaluation. He makes a big deal out of not needing to know where his inputs come from, as well as not needing to invoke a function to create his inputs, but it still seems he must have a reference to his inputs. The effectively automatic parallellization of the code is pretty neat. Not so much because it is parallelized (which can be done in other systems), but mostly because it required no forethought or synchronization. It is automatically parallelized and pipelined. Neato. Of course, we aren't going to get much of that in js without some work. The second to last paragraph was another head turner. I had previously viewed every dataflow node/path as a loop that just waits for a change in its inputs and computes a new value when one of them changes. However, in his system recursive calls are also parallelized and pipelined. I am not quite sure how this would be implemented, but it seems neat. Again though, probably not relevant to js.
Re: Is Clojure right for me?
Thank you, Malcolm. I'm completely new to LISP and its dialects and I'm a little bit worried about the absence of support for OOP in Clojure. How do you decompose large systems in Clojure? On Thursday, December 26, 2013 2:52:26 PM UTC+1, Malcolm Sparks wrote: Hi Massimiliano. The absence of a well-established framework for web development in Clojure is not a sign of its immaturity (rather the opposite). Web frameworks can give you some increased productivity to begin with, but as soon as you need to do something that isn't naturally supported by your chosen web framework you're in trouble, and that's when productivity drops off a cliff as you struggle to bend the web framework to your requirements. For example, you choose a web framework with good REST support, then find out later you need to add web sockets. I've written and deployed about a dozen serious web applications using Clojure. My opinion is the best strategy that guarantees long-term productivity is to build your system from a set of smaller components that you choose 'a la carte'. That way, if your requirements change you can swap in and out other components as you need to. I would guess that the vast majority of Clojure web applications are written this way, which is why you don't see widescale adoption of a particular web 'framework' by the Clojure community. Instead, Clojure developers pick from a set of constituent parts: Jetty, http-kit, Ring, Compojure, Hiccup, Enlive, Stencil, Liberator, domina, dommy, C2, Om, shameless-plugbidi/shameless-plug, and so on and so on. The fact that these components all fit together so well is one of the truly outstanding features of the Clojure platform. Few languages come close to this level of integration, which is why they actively curate frameworks. Investing time in Clojure is both pleasurable and productive. It's a question of whether you want 'short-term' productivity to meet a particular project goal (choose a web framework), or sustainable productivity to deliver value to your users over the longer term (choose to learn, understand and utilize a set of components from the wide pool that the Clojure community has created). Regards, Malcolm On Wednesday, December 25, 2013 9:06:20 PM UTC, Massimiliano Tomassoli wrote: Hi, I'm not sure if Clojure is the right language for me. I'd like to use Clojure mainly for web development but I don't know if it's already mature enough to be productive. For instance, Scala has Play, Groovy has Grails, etc... If I'm not wrong, Clojure doesn't have a well-established framework for web development. I'm intrigued by Clojure because I like functional programming, but I need to be productive and, alas, I don't have time to learn Clojure just for my pleasure. -- -- 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/groups/opt_out.
Re: Is Clojure right for me?
On Thursday, December 26, 2013 11:16:07 AM UTC+1, James Reeves wrote: What sort of web development were you planning to do? I'd like to build websites. What kind depends on what my clients need. -- -- 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/groups/opt_out.
Re: Is Clojure right for me?
On Thursday, December 26, 2013 7:55:05 AM UTC+1, Devin Walters (devn) wrote: http://hoplon.io/#/home/ http://caribou.github.io/caribou/docs/outline.html On Thursday, December 26, 2013 at 12:26 AM, tao wrote: http://pedestal.io/ http://www.luminusweb.net/ Why so many frameworks? It's difficult to decide which one to use and you'll find fewer people that use the same framework and can answer your questions. -- -- 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/groups/opt_out.
Re: Is Clojure right for me?
Yes, I feel framework is a patch to a language. Use framework can do some thing productively, but also limit you do some thing poorly. Prefer Libraries to Frameworks http://blog.getprismatic.com/blog/2012/4/5/software-engineering-at-prismatic.html -- tao Sent with Sparrow (http://www.sparrowmailapp.com/?sig) On Thursday, December 26, 2013 at 9:52 PM, Malcolm Sparks wrote: Hi Massimiliano. The absence of a well-established framework for web development in Clojure is not a sign of its immaturity (rather the opposite). Web frameworks can give you some increased productivity to begin with, but as soon as you need to do something that isn't naturally supported by your chosen web framework you're in trouble, and that's when productivity drops off a cliff as you struggle to bend the web framework to your requirements. For example, you choose a web framework with good REST support, then find out later you need to add web sockets. I've written and deployed about a dozen serious web applications using Clojure. My opinion is the best strategy that guarantees long-term productivity is to build your system from a set of smaller components that you choose 'a la carte'. That way, if your requirements change you can swap in and out other components as you need to. I would guess that the vast majority of Clojure web applications are written this way, which is why you don't see widescale adoption of a particular web 'framework' by the Clojure community. Instead, Clojure developers pick from a set of constituent parts: Jetty, http-kit, Ring, Compojure, Hiccup, Enlive, Stencil, Liberator, domina, dommy, C2, Om, shameless-plugbidi/shameless-plug, and so on and so on. The fact that these components all fit together so well is one of the truly outstanding features of the Clojure platform. Few languages come close to this level of integration, which is why they actively curate frameworks. Investing time in Clojure is both pleasurable and productive. It's a question of whether you want 'short-term' productivity to meet a particular project goal (choose a web framework), or sustainable productivity to deliver value to your users over the longer term (choose to learn, understand and utilize a set of components from the wide pool that the Clojure community has created). Regards, Malcolm On Wednesday, December 25, 2013 9:06:20 PM UTC, Massimiliano Tomassoli wrote: Hi, I'm not sure if Clojure is the right language for me. I'd like to use Clojure mainly for web development but I don't know if it's already mature enough to be productive. For instance, Scala has Play, Groovy has Grails, etc... If I'm not wrong, Clojure doesn't have a well-established framework for web development. I'm intrigued by Clojure because I like functional programming, but I need to be productive and, alas, I don't have time to learn Clojure just for my pleasure. -- -- 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 (mailto: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 (mailto: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 (mailto:clojure+unsubscr...@googlegroups.com). For more options, visit https://groups.google.com/groups/opt_out. -- -- 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/groups/opt_out.
Re: [ANN] Clojure.Joda-Time 0.1.0
I think your usage of simple check is interesting. What bugs did simple-check find inside Joda and can you speak about that process in general? On Wednesday, December 25, 2013 6:19:18 AM UTC-5, dm3 wrote: Hello, I would like to announce the first release of Clojure.Joda-Timehttps://github.com/dm3/clojure.joda-time - an ambitiously named wrapper for the Joda-Time date and time library. Main goals of Clojure.Joda-Time: * Provide a consistent API for common operations with instants, date-times, periods, partials and intervals. * Provide an escape hatch from Joda types to clojure datastructures and back where possible. * Avoid reflective calls (this is a problem, because many types in Joda-Time have similar functionality hidden under similarly named and overloaded methods with no common interfaces). * Provide an entry point into Joda-Time by freeing the user from importing most of the Joda-Time classes. Compared to clj-time https://github.com/clj-time/clj-time, this library is not DateTime-centric. If you tend to use local dates in most of your projects, meaning you don't care about time zones, there's no purpose in using DateTime at all. You should be using various Partials provided by Joda-Time, most common being LocalDate and LocalDateTime. This also means that date-times created through Clojure.Joda-Time are not converted to the UTC timezone by default, as they are in clj-time. There's quite a comprehensive README on github: https://github.com/dm3/clojure.joda-time as well as the API-docs: http://dm3.github.io/clojure.joda-time/ This is pretty much an experiment, albeit a very elaborate one (and time consuming). Feel free to suggest improvements/rant about deficiencies :) Fun facts: * first release may be treated as a Christmas present * while testing the library with simple-check ~10 bugs were identified (most of them already fixed) in the Joda-Time itself * library contains an implementation partial intervals (e.g. interval of LocalDates) -- -- 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/groups/opt_out.
Re: Is Clojure right for me?
On 26 December 2013 16:32, Massimiliano Tomassoli kiuhn...@gmail.comwrote: Thank you, Malcolm. I'm completely new to LISP and its dialects and I'm a little bit worried about the absence of support for OOP in Clojure. How do you decompose large systems in Clojure? You write functions. To quote Alan J. Perlis: It is better to have 100 functions operate on one data structure than to have 10 functions operate on 10 data structures. IMO, OOP just makes it harder to build modular systems, because OOP involves a lot of implicit connections between components. Clojure, and other functional languages, tend to emphasise isolation more. - James -- -- 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/groups/opt_out.
Re: Is Clojure right for me?
On Thursday, December 26, 2013 7:51:39 PM UTC+1, James Reeves wrote: On 26 December 2013 16:32, Massimiliano Tomassoli kiuh...@gmail.comjavascript: wrote: Thank you, Malcolm. I'm completely new to LISP and its dialects and I'm a little bit worried about the absence of support for OOP in Clojure. How do you decompose large systems in Clojure? You write functions. To quote Alan J. Perlis: It is better to have 100 functions operate on one data structure than to have 10 functions operate on 10 data structures. Classes or objects are not simple data structures. IMO, OOP just makes it harder to build modular systems, because OOP involves a lot of implicit connections between components. Clojure, and other functional languages, tend to emphasise isolation more. Why implicit? Objects communicate through well-defined channels. OOP can certainly be misused but it served me well for over 20 years (C++/C#). And Scala proves that FP and OOP are orthogonal paradigms. I can't see how the lack of OOP is a good thing for Clojure, honestly. I'm willing to give up mutability because I never programmed that way and I believe it can be a good thing (after I get used to it), but giving up OOP means going back to something I already know and I don't like. -- -- 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/groups/opt_out.
Re: Is Clojure right for me?
exactly which part of OOP is missing in clojure that you would like to use? if you took my java code and ported it to clojure, the main difference would be (a b) instead of b.a , but the main design would be similar 2013/12/26 Massimiliano Tomassoli kiuhn...@gmail.com On Thursday, December 26, 2013 7:51:39 PM UTC+1, James Reeves wrote: On 26 December 2013 16:32, Massimiliano Tomassoli kiuh...@gmail.comwrote: Thank you, Malcolm. I'm completely new to LISP and its dialects and I'm a little bit worried about the absence of support for OOP in Clojure. How do you decompose large systems in Clojure? You write functions. To quote Alan J. Perlis: It is better to have 100 functions operate on one data structure than to have 10 functions operate on 10 data structures. Classes or objects are not simple data structures. IMO, OOP just makes it harder to build modular systems, because OOP involves a lot of implicit connections between components. Clojure, and other functional languages, tend to emphasise isolation more. Why implicit? Objects communicate through well-defined channels. OOP can certainly be misused but it served me well for over 20 years (C++/C#). And Scala proves that FP and OOP are orthogonal paradigms. I can't see how the lack of OOP is a good thing for Clojure, honestly. I'm willing to give up mutability because I never programmed that way and I believe it can be a good thing (after I get used to it), but giving up OOP means going back to something I already know and I don't like. -- -- 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/groups/opt_out. -- -- 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/groups/opt_out.
Re: Clojure.org: Concurrency screencast 404
Which page had the link? -- -- 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/groups/opt_out.
Re: Is Clojure right for me?
On Thursday, December 26, 2013 11:32:51 AM UTC-5, Massimiliano Tomassoli wrote: Thank you, Malcolm. I'm completely new to LISP and its dialects and I'm a little bit worried about the absence of support for OOP in Clojure. How do you decompose large systems in Clojure? This presentation has been really helpful in that regard for me: Clojure in the Largehttp://www.infoq.com/presentations/Clojure-Large-scale-patterns-techniques Even though Clojure is not OOP in the way Java is, you can go a long way with Protocols and namespaces, imho. -- -- 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/groups/opt_out.
Re: Is Clojure right for me?
Agree, classes are not simple structures, they carry internal mutable state and hidden behaviours. Compounding mutable objects creates a huge brittled context were system state at any given point in time is untraceable by a normal human brain except in simplistic systems. Now you could create un mutable objects but then why bother creating classes with hidden behaviours if there is no hidden state ? Please explain then the advantage of using classes in this context versus name spaces to delimit concerns with high order functions ? How can you stick to both things at the same time ? Luc P. -- Luc Prefontainelprefonta...@softaddicts.ca sent by ibisMail! -- -- 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/groups/opt_out.
Re: Is Clojure right for me?
On Thursday, December 26, 2013 9:01:56 PM UTC+1, HamsterofDeath wrote: exactly which part of OOP is missing in clojure that you would like to use? if you took my java code and ported it to clojure, the main difference would be (a b) instead of b.a , but the main design would be similar How can that be? What about encapsulation, inheritance and polymorphism? OOP is not just syntactic sugar. If I were to implement something (complex enough) in C and C++ the differences between my implementations would be far from superficial. -- -- 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/groups/opt_out.
Re: Is Clojure right for me?
Encapsulation: a) I don't miss it. b) Functions/private-namespaces/maps/deftypes can serve this purpose. Inheritance: Clojure provides ad-hoc hierarchies, which give you the desired tree structure of a type-hierarchy, but it is decoupled from implementation details. You can inherit implementations in lots of ways in clojure. The simplest conceptually in my mind is simply a hash-map of keys to functions. Once you start doing it, the question shifts to do you need a 'this' pointer? 'this' makes a first argument to a pure function implicit. In most cases, you don't need it. If you do need it, deftypes or records can fill in the gap. Records and deftypes also participate in protocols, which provides... Polymorphism: Single-dispatch is a degenerate case of more generalized multiple dispatch, which we have via multi-methods. It turns out that JVMs are pretty good at it, but conceptually I think of 'dispatching on the type' as an implementation detail or optimization, not something to build a language around (java, C++, ...). Protocols give this kind of fast-implementation polymorphism back to you in a decoupled form. Reify/proxy are just so darned convenient, both with JVM interfaces and clojure protocols. There's nothing missing here, it's just disassembled and presented back to you in pieces as part of a practical and philosophical argument. This is the 'design by decoupling' thought. What _is_ missing here is an actually helpful static type-system (there's WIP), but immutable data is the best glue for a dynamic one, in my opinion, as it provides easy isolation of components. I don't miss java's, that's for sure. Some things that didn't look like syntactic sugar will start to look like syntactic sugar once you get deep into compiler internals and macros :-). Lisp broke me in this way, but I like it. On Thu, Dec 26, 2013 at 8:32 AM, Massimiliano Tomassoli kiuhn...@gmail.comwrote: On Thursday, December 26, 2013 9:01:56 PM UTC+1, HamsterofDeath wrote: exactly which part of OOP is missing in clojure that you would like to use? if you took my java code and ported it to clojure, the main difference would be (a b) instead of b.a , but the main design would be similar How can that be? What about encapsulation, inheritance and polymorphism? OOP is not just syntactic sugar. If I were to implement something (complex enough) in C and C++ the differences between my implementations would be far from superficial. -- -- 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/groups/opt_out. -- -- 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/groups/opt_out.
Re: Is Clojure right for me?
On 26 December 2013 19:53, Massimiliano Tomassoli kiuhn...@gmail.comwrote: Why implicit? Objects communicate through well-defined channels. OOP can certainly be misused but it served me well for over 20 years (C++/C#). And Scala proves that FP and OOP are orthogonal paradigms. I can't see how the lack of OOP is a good thing for Clojure, honestly. I'm willing to give up mutability because I never programmed that way and I believe it can be a good thing (after I get used to it), but giving up OOP means going back to something I already know and I don't like. Clojure provides all the functionality of OOP, but separated into specialised tools. For grouping functions, we have namespaces. For polymorphism, we have multimethods and protocols. For encapsulation there are closures, and for inheritance we have the derive and isa? functions. I've worked with OOP systems for over a decade, but it wasn't until I started using Clojure that really started to understand the separate pieces of functionality that OOP bundles together. I found that there were some pieces I used regularly (such as namespaces), some pieces I used occasionally (polymorphism), and some pieces I didn't use at all (encapsulation and inheritance). Clojure emphasises simplicity, which in this case means should aim for tools that perform specific tasks, rather than tools that attempt to tackle everything at once. This is why Clojure doesn't have OOP, because Clojure prefers having a diverse toolbox of individual tools, rather than a single generic tool that acts as a swiss army knife. Clojure also rejects the idea that we should hide data structures behind an API (i.e. encapsulation). This is the opposite of OOP doctrine, which suggests that data structures need to be hidden to prevent constant refactoring. In practise, I find I need to refactor *less* with Clojure, while at the same time avoiding the need to hide information, and the repetition that comes with having to re-implement part of the functionality of a map, every time I build an object. When I started using Clojure, I almost started on an OOP system for it. Within a few weeks, I began to understand that wasn't necessary. After 5 years, I'm very much sold on Clojure's methodology. I suspect I'm not alone in this, otherwise there would be at least a dozen OO systems for Clojure. To my knowledge, there are zero so far. - James -- -- 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/groups/opt_out.
Re: [ANN] Clojure.Joda-Time 0.1.0
It looks good, though can you explain the rationale for having a separate library? It seems from my perspective as if the objective of exposing all the good Joda functionality for Clojure consumption would be more readily achieved by extending the existing clj-time library. I chose to write it as a separate library because the approach to wrapping JodaTime API is quite different from clj-time. Clj-time is opinionated in the sense that it puts DateTimes in the UTC time zone at the center of the API. Clojure.joda-time on the other hand doesn't force time zones in date-times and provides a rich support for partials (LocalDate/LocalDateTime) which should be used when time zones are irrelevant. I agree that having one JodaTime wrapper would be quite enough, but clojure.joda-time grew out of my frustration with a couple of bugs I got while using clj-time (yes, I didn't expect date-times in the UTC time zone by default, and yes, I know that I should be blamed for not reading the documentation :)). In any case, having released the thing, I would be interested in unifying the APIs with clj-time and merging into a single project. I think your usage of simple check is interesting. What bugs did simple-check find inside Joda and can you speak about that process in general? Simple-check found a bunch of bugs with Partials, mainly concerning the rarely used DateTimeFieldTypes such as era, yearOfCentury, weekyear, etc. Also a couple of edge cases with DateTime properties. Interestingly, the bugs were found not in the properties themselves, as properties checked the code I wrote which is quite simple, but in the generators. And let me say, debugging generators is a PITA. The process of writing properties is quite simple, just think of a property and write it in code :) The harder part is defining generators for the data fed into the properties. Now that I think of it, it would probably be useful to clean up the generators and publish them separately to enable people writing more simple-check specifications when interacting with JodaTime... -- -- 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/groups/opt_out.
Re: Is Clojure right for me?
On Thursday, December 26, 2013 9:18:06 PM UTC+1, Luc wrote: Now you could create un mutable objects but then why bother creating classes with hidden behaviours if there is no hidden state ? The state is still hidden. Even if the state is immutable: 1) other code could access it and, thus, changing the inner working of your class would break that code; 2) other code could create a new instance of your class with inconsistent internal state. As you can see, immutability is totally orthogonal to object orientation. Encapsulation is still useful, as are inheritance and polymorphism. -- -- 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/groups/opt_out.
Re: Is Clojure right for me?
a) encapsulation of unmutable state ? What for ? b) inheritance ? see a) c) polymorphism ? Multimethods (which are more flexible) or protocols Nice words but not much else. Comparing C versus C++ is fair but this comparison does not relate at all to Clojure, it's like answering blue to the question which even number sits between 1 and 3 ? I am still waiting for an answer to my previous post btwy... Luc P. On Thursday, December 26, 2013 9:01:56 PM UTC+1, HamsterofDeath wrote: exactly which part of OOP is missing in clojure that you would like to use? if you took my java code and ported it to clojure, the main difference would be (a b) instead of b.a , but the main design would be similar How can that be? What about encapsulation, inheritance and polymorphism? OOP is not just syntactic sugar. If I were to implement something (complex enough) in C and C++ the differences between my implementations would be far from superficial. -- -- 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/groups/opt_out. -- Softaddictslprefonta...@softaddicts.ca sent by ibisMail from my ipad! -- -- 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/groups/opt_out.
Re: Is Clojure right for me?
On 26 Dec 2013 21:04, Softaddicts lprefonta...@softaddicts.ca wrote: a) encapsulation of unmutable state ? What for ? b) inheritance ? see a) c) polymorphism ? Multimethods (which are more flexible) or protocols Nice words but not much else. Comparing C versus C++ is fair but this comparison does not relate at all to Clojure, it's like answering blue to the question which even number sits between 1 and 3 ? I am still waiting for an answer to my previous post btwy... Let's be nice. We're supposed to have a welcoming community, not a combative one :) - James -- -- 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/groups/opt_out.
Re: Is Clojure right for me?
If I were to implement something (complex enough) in C and C++ the differences between my implementations would be far from superficial. Those are both inexpressive in different ways. In my opinion java is closer to lisp than C++, given garbage collection, closures (even faked by objects), reflection (code-as-data), classloading (eval). On Thu, Dec 26, 2013 at 9:15 AM, James Reeves ja...@booleanknot.com wrote: On 26 Dec 2013 21:04, Softaddicts lprefonta...@softaddicts.ca wrote: a) encapsulation of unmutable state ? What for ? b) inheritance ? see a) c) polymorphism ? Multimethods (which are more flexible) or protocols Nice words but not much else. Comparing C versus C++ is fair but this comparison does not relate at all to Clojure, it's like answering blue to the question which even number sits between 1 and 3 ? I am still waiting for an answer to my previous post btwy... Let's be nice. We're supposed to have a welcoming community, not a combative one :) - James -- -- 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/groups/opt_out. -- -- 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/groups/opt_out.
Re: Is Clojure right for me?
Ok I'll drop the subject. Still cannot understand why people cannot try something new w/o sticking to the stuff they know already until they are totally immersed in the new thing. And by that I mean use the new thing as it was intended. Then you can generate useful conclusions and get some benefits from this learning process. I was just teasing a bit :) If I were to be combative, it would be much worse :) Luc P. On 26 Dec 2013 21:04, Softaddicts lprefonta...@softaddicts.ca wrote: a) encapsulation of unmutable state ? What for ? b) inheritance ? see a) c) polymorphism ? Multimethods (which are more flexible) or protocols Nice words but not much else. Comparing C versus C++ is fair but this comparison does not relate at all to Clojure, it's like answering blue to the question which even number sits between 1 and 3 ? I am still waiting for an answer to my previous post btwy... Let's be nice. We're supposed to have a welcoming community, not a combative one :) - James -- -- 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/groups/opt_out. -- Softaddictslprefonta...@softaddicts.ca sent by ibisMail from my ipad! -- -- 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/groups/opt_out.
Re: How to go about 'proving' why dynamically typed languages are better.
On Tue, Dec 24, 2013 at 12:23 PM, Rich Morin r...@cfcl.com wrote: On Dec 24, 2013, at 02:09, Cedric Greevey wrote: On Mon, Dec 23, 2013 at 7:37 PM, Rich Morin r...@cfcl.com wrote: Media for Thinking the Unthinkable: Designing a new medium for science and engineering http://worrydream.com/MediaForThinkingTheUnthinkable/ Is this available in a form that is skimmable, is greppable, is cheap for mobile users, can be perused at leisure, fits on a thumb drive, is convertible for Kindle use, and doesn't require installing and enabling notoriously insecure browser plugins to view, or is it only available as video? :( There is a video presentation, which could be downloaded and watched at leisure (eg, on a smart phone). I don't think this presents any security issues. Oh, I don't doubt that the *video* doesn't present any security issues. It's the Flash plugin needed to watch it that presents security issues. -- -- 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/groups/opt_out.
Re: get rid of reflection in proxy-super?
I'd suggest instead amending the core language to add a special form, maybe named .!, that works like . except it sees protected methods (and will cause an IllegalAccessError if it calls a protected method from outside of a subclass), and amend proxy to use .! for proxy-super (and put the proxy-super call in the method body and not in the fn that the rest of the proxy body goes into, which will avoid IllegalAccessError but make it so that on-the-fly modification of the proxy can't change the proxy-super part). On Wed, Dec 25, 2013 at 3:04 PM, Colin Fleming colin.mailingl...@gmail.comwrote: Right, it doesn't fix your original problem of the reflection warning. Thinking about it, there's no way to get rid of that warning since in the end all interop (unless it uses a built in form) must expand to the dot form, which has no way to call a protected method. The only solution I can see would be to derive a Java class from JPanel and just override paintComponent and make it public, then you can proxy that class. On 25 December 2013 23:14, Jim - FooBar(); jimpil1...@gmail.com wrote: Thanks Colin, I did vote for it but its title implies something different...something restoring original binding on exception... Jim On 25/12/13 04:06, Colin Fleming wrote: That is indeed the same issue, and it even includes a patch with a test! I've voted for this one, please consider doing the same if this issue has caught you. Link: http://dev.clojure.org/jira/browse/CLJ-983 On 25 December 2013 13:22, Matching Socks phill.w...@gmail.com wrote: (Re Colin's note that a proxy gets damaged if super throws - goodness gracious! Is it the same matter as Clojure Jira issue No.983? It's marked as minor and affecting Clojure 1.3, and no one has voted for it.) -- -- 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/groups/opt_out. -- -- 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/groups/opt_out. -- -- 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/groups/opt_out. -- -- 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/groups/opt_out. -- -- 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
Re: Is Clojure right for me?
clojurekoans.com uses Joodo. https://github.com/slagyr/joodo What are some other cool sites powered by Clojure? On Wednesday, December 25, 2013 4:06:20 PM UTC-5, Massimiliano Tomassoli wrote: Hi, I'm not sure if Clojure is the right language for me. I'd like to use Clojure mainly for web development but I don't know if it's already mature enough to be productive. For instance, Scala has Play, Groovy has Grails, etc... If I'm not wrong, Clojure doesn't have a well-established framework for web development. I'm intrigued by Clojure because I like functional programming, but I need to be productive and, alas, I don't have time to learn Clojure just for my pleasure. -- -- 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/groups/opt_out.
Re: Is Clojure right for me?
http://preview.getprismatic.com/news/home On Thu, Dec 26, 2013 at 2:42 PM, john walker john.lou.wal...@gmail.comwrote: clojurekoans.com uses Joodo. https://github.com/slagyr/joodo What are some other cool sites powered by Clojure? On Wednesday, December 25, 2013 4:06:20 PM UTC-5, Massimiliano Tomassoli wrote: Hi, I'm not sure if Clojure is the right language for me. I'd like to use Clojure mainly for web development but I don't know if it's already mature enough to be productive. For instance, Scala has Play, Groovy has Grails, etc... If I'm not wrong, Clojure doesn't have a well-established framework for web development. I'm intrigued by Clojure because I like functional programming, but I need to be productive and, alas, I don't have time to learn Clojure just for my pleasure. -- -- 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/groups/opt_out. -- -- 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/groups/opt_out.
Re: get rid of reflection in proxy-super?
The problem is that your approach requires creating the proxy class with the method bodies actually compiled into the body of the proxy class method, they can't be in fns in a proxy map as they are now. This is ok in the case where a method body is just the proxy-super call, but most aren't - they call proxy-super as part of a much larger method. Changing that is a fundamental change to the way proxies work, and IMO would be better served by creating a new form (extend-class or something similar) which would behave in a more similar way to reify but would allow extension. I've considered writing such a thing myself due to the limitations and idiosyncrasies of proxy/genclass but I've not investigated whether it's even possible without hacking the compiler - I suspect it's not. On 27 December 2013 11:20, Cedric Greevey cgree...@gmail.com wrote: I'd suggest instead amending the core language to add a special form, maybe named .!, that works like . except it sees protected methods (and will cause an IllegalAccessError if it calls a protected method from outside of a subclass), and amend proxy to use .! for proxy-super (and put the proxy-super call in the method body and not in the fn that the rest of the proxy body goes into, which will avoid IllegalAccessError but make it so that on-the-fly modification of the proxy can't change the proxy-super part). On Wed, Dec 25, 2013 at 3:04 PM, Colin Fleming colin.mailingl...@gmail.com wrote: Right, it doesn't fix your original problem of the reflection warning. Thinking about it, there's no way to get rid of that warning since in the end all interop (unless it uses a built in form) must expand to the dot form, which has no way to call a protected method. The only solution I can see would be to derive a Java class from JPanel and just override paintComponent and make it public, then you can proxy that class. On 25 December 2013 23:14, Jim - FooBar(); jimpil1...@gmail.com wrote: Thanks Colin, I did vote for it but its title implies something different...something restoring original binding on exception... Jim On 25/12/13 04:06, Colin Fleming wrote: That is indeed the same issue, and it even includes a patch with a test! I've voted for this one, please consider doing the same if this issue has caught you. Link: http://dev.clojure.org/jira/browse/CLJ-983 On 25 December 2013 13:22, Matching Socks phill.w...@gmail.com wrote: (Re Colin's note that a proxy gets damaged if super throws - goodness gracious! Is it the same matter as Clojure Jira issue No.983? It's marked as minor and affecting Clojure 1.3, and no one has voted for it.) -- -- 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/groups/opt_out. -- -- 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/groups/opt_out. -- -- 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/groups/opt_out. -- -- 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
Re: Is Clojure right for me?
You can define vars to be private to a namespace in clojure, thus preventing (1). In practice, I've found that (2) never comes up. Ultimately, you won't truly appreciate what is being said in this conversation without giving it a chance and trying it out. On Thursday, December 26, 2013 4:02:49 PM UTC-5, Massimiliano Tomassoli wrote: On Thursday, December 26, 2013 9:18:06 PM UTC+1, Luc wrote: Now you could create un mutable objects but then why bother creating classes with hidden behaviours if there is no hidden state ? The state is still hidden. Even if the state is immutable: 1) other code could access it and, thus, changing the inner working of your class would break that code; 2) other code could create a new instance of your class with inconsistent internal state. As you can see, immutability is totally orthogonal to object orientation. Encapsulation is still useful, as are inheritance and polymorphism. -- -- 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/groups/opt_out.
Re: Is Clojure right for me?
On Thursday, December 26, 2013 10:26:11 PM UTC+1, Gary Trakhman wrote: If I were to implement something (complex enough) in C and C++ the differences between my implementations would be far from superficial. Those are both inexpressive in different ways. In my opinion java is closer to lisp than C++, given garbage collection, closures (even faked by objects), reflection (code-as-data), classloading (eval). You can do metaprogramming in C++ (with templates, which are Turing-complete) and now it supports closures and many other things. Unfortunately, it's become too complex. D would be a better choice if only it was more popular. -- -- 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/groups/opt_out.
Re: Is Clojure right for me?
On Thursday, December 26, 2013 11:04:00 PM UTC+1, Luc wrote: Ok I'll drop the subject. Still cannot understand why people cannot try something new w/o sticking to the stuff they know already until they are totally immersed in the new thing. And by that I mean use the new thing as it was intended. Then you can generate useful conclusions and get some benefits from this learning process. Learning every single language just to find the right one is not very time-efficient. -- -- 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/groups/opt_out.
Re: Is Clojure right for me?
On Thursday, December 26, 2013 10:04:21 PM UTC+1, Luc wrote: a) encapsulation of unmutable state ? What for ? b) inheritance ? see a) c) polymorphism ? Multimethods (which are more flexible) or protocols Nice words but not much else. Comparing C versus C++ is fair but this comparison does not relate at all to Clojure, it's like answering blue to the question which even number sits between 1 and 3 ? I am still waiting for an answer to my previous post btwy... I did answer to your post. -- -- 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/groups/opt_out.
Re: Is Clojure right for me?
On 27 December 2013 00:16, Massimiliano Tomassoli kiuhn...@gmail.comwrote: On Thursday, December 26, 2013 11:04:00 PM UTC+1, Luc wrote: Ok I'll drop the subject. Still cannot understand why people cannot try something new w/o sticking to the stuff they know already until they are totally immersed in the new thing. And by that I mean use the new thing as it was intended. Then you can generate useful conclusions and get some benefits from this learning process. Learning every single language just to find the right one is not very time-efficient. There are a lot of programming languages, but you can get a good overview from just few. If I had to pick just four to provide a reasonable spread of ideas, I'd suggest Scheme, C, Smalltalk and Haskell. In my very subjective estimation, Clojure sits somewhere between Scheme and Haskell. However, assuming you don't want to spend several months researching interesting programming languages, let me see if I can make an argument against OOP that requires a little less background reading :) Clojure has been around for over six years now, and has all the components necessary to construct an object system. It would take maybe a few hours to build a library for Clojure that provide support for OOP. To the best of my knowledge, however, no-one has. If OOP was a particularly useful paradigm, why the lack of interest in reproducing it in Clojure? Perhaps it's worth investigating how Clojure manages without it? - James -- -- 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/groups/opt_out.
Re: Is Clojure right for me?
On Thursday, December 26, 2013 10:00:46 PM UTC+1, James Reeves wrote: On 26 December 2013 19:53, Massimiliano Tomassoli kiuh...@gmail.comjavascript: wrote: Why implicit? Objects communicate through well-defined channels. OOP can certainly be misused but it served me well for over 20 years (C++/C#). And Scala proves that FP and OOP are orthogonal paradigms. I can't see how the lack of OOP is a good thing for Clojure, honestly. I'm willing to give up mutability because I never programmed that way and I believe it can be a good thing (after I get used to it), but giving up OOP means going back to something I already know and I don't like. Clojure provides all the functionality of OOP, but separated into specialised tools. For grouping functions, we have namespaces. For polymorphism, we have multimethods and protocols. For encapsulation there are closures, and for inheritance we have the derive and isa? functions. I've worked with OOP systems for over a decade, but it wasn't until I started using Clojure that really started to understand the separate pieces of functionality that OOP bundles together. I found that there were some pieces I used regularly (such as namespaces), some pieces I used occasionally (polymorphism), and some pieces I didn't use at all (encapsulation and inheritance). Clojure emphasises simplicity, which in this case means should aim for tools that perform specific tasks, rather than tools that attempt to tackle everything at once. This is why Clojure doesn't have OOP, because Clojure prefers having a diverse toolbox of individual tools, rather than a single generic tool that acts as a swiss army knife. Clojure also rejects the idea that we should hide data structures behind an API (i.e. encapsulation). This is the opposite of OOP doctrine, which suggests that data structures need to be hidden to prevent constant refactoring. In practise, I find I need to refactor *less* with Clojure, while at the same time avoiding the need to hide information, and the repetition that comes with having to re-implement part of the functionality of a map, every time I build an object. When I started using Clojure, I almost started on an OOP system for it. Within a few weeks, I began to understand that wasn't necessary. After 5 years, I'm very much sold on Clojure's methodology. I suspect I'm not alone in this, otherwise there would be at least a dozen OO systems for Clojure. To my knowledge, there are zero so far. OK, I'll give Clojure a try. Thanks for your time. -- -- 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/groups/opt_out.
Re: Clojure can't import some Java classes
In case anyone is interested in a workaround for this, I managed to fix my compilation by stubbing out the problematic classes and putting the stubs ahead of the real classes in the classpath when I compile. Where those stubs return other objects that are required during static initialisation, I create those classes with Mockito. I feel dirty all over but it does work. I'm also tinkering with a fork of Clojure in the background that uses ASM Types instead of Class objects. It's still a long way from done but it's looking like that might provide a solution for compilation, at least. I'll report back if I ever get it working. On 15 December 2013 14:05, Colin Fleming colin.mailingl...@gmail.comwrote: I've just spent some time today looking at the compiler code, and unfortunately I think the answer is no. When a symbol is imported, Clojure currently instantiates the Class object using Class.forName() and stores that in the namespace's mapping. At the point the Class is instantiated, static initializers are run. So the only way to avoid that is not instantiate the Class and store something else in the mapping. Alex's suggestion above to store the string representing the class name and load the class on demand might work for REPL style development but won't work for AOT compilation since reflection is used to find fields, methods etc on the class during compilation. The only solution that I can see that would work for AOT would be to store some sort of class wrapper object which reads the class bytecode to get that information without instantiating the class. However both of these suggestions break a fairly fundamental assumption - that importing a class creates a mapping from its name to a Class object. I have no idea what sort of code might be out there making that assumption, but it's probably fair to assume there could be a lot of it. At some point I might look into creating a fork of Clojure I just use to AOT compile. On 12 December 2013 03:41, Robin Heggelund Hansen skinney...@gmail.comwrote: Is this something that is fixable? -- -- 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/groups/opt_out. -- -- 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/groups/opt_out.
Re: Is Clojure right for me?
This depends strictly on your learning speed which I will not comment here :) It took me three months full time to start to feel at ease with Clojure writing production code and I was around 45 years old at the time. Learning is never inefficient... when you want to learn. Luc P On Thursday, December 26, 2013 11:04:00 PM UTC+1, Luc wrote: Ok I'll drop the subject. Still cannot understand why people cannot try something new w/o sticking to the stuff they know already until they are totally immersed in the new thing. And by that I mean use the new thing as it was intended. Then you can generate useful conclusions and get some benefits from this learning process. Learning every single language just to find the right one is not very time-efficient. -- -- 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/groups/opt_out. -- Luc Prefontainelprefonta...@softaddicts.ca sent by ibisMail! -- -- 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/groups/opt_out.
Re: Is Clojure right for me?
I do like the way Clojure steers you away from all sorts of unnecessary OO-nonsense, and provides most of the raw capabilities of OO in other forms. However, even if you avoid mutable state, inheritance, and polymorphism, Classes/objects make great namespaces, and Clojure's namespaces can't do everything classes can do, for example, cyclic dependencies. This was the subject of my blog post yesterday. Take a look at the following gist code for one of the scenarios that frequently drives me up a wall: https://gist.github.com/Engelberg/8141352 I'd love to hear any tricks you guys use to deal with situations like this in your own code. -- -- 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/groups/opt_out.
Re: Is Clojure right for me?
Hi Mark, I am not following your example. Can you post (pseudocode fine) what a good OO impl would look like, and why Clojure's defrecords can't do something similar? Stu On Thu, Dec 26, 2013 at 9:08 PM, Mark Engelberg mark.engelb...@gmail.comwrote: I do like the way Clojure steers you away from all sorts of unnecessary OO-nonsense, and provides most of the raw capabilities of OO in other forms. However, even if you avoid mutable state, inheritance, and polymorphism, Classes/objects make great namespaces, and Clojure's namespaces can't do everything classes can do, for example, cyclic dependencies. This was the subject of my blog post yesterday. Take a look at the following gist code for one of the scenarios that frequently drives me up a wall: https://gist.github.com/Engelberg/8141352 I'd love to hear any tricks you guys use to deal with situations like this in your own code. -- -- 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/groups/opt_out. -- -- 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/groups/opt_out.
Re: Is Clojure right for me?
Does this OO pseudocode help clarify at all? https://gist.github.com/Engelberg/8142000 On Thu, Dec 26, 2013 at 6:27 PM, Stuart Halloway stuart.hallo...@gmail.comwrote: Hi Mark, I am not following your example. Can you post (pseudocode fine) what a good OO impl would look like, and why Clojure's defrecords can't do something similar? Stu -- -- 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/groups/opt_out.
Re: Is Clojure right for me?
One reason it might not be clear what I'm driving it is that in trying to create a minimalist example, I used grid dimensions, and in reality, you'd probably know right away to put something like that in a data structure, and pass it around to all your functions. Try to imagine that at the beginning of your project, you really do believe that you're only going to ever be working with 3x4 grids, and then later, you realize that's not the case. In the early phase, it's very easy to construct a bunch of functions that all refer to those shared vars (in my example `rows` and `cols`). Later, when you realize rows and cols can change, making those names parameters is a major overhaul to the codebase. I believe that most Clojurians try to delay the refactoring by using `binding` to alter those vars. But that's a fragile strategy, and eventually the code typically needs to be rewritten. On Thu, Dec 26, 2013 at 7:04 PM, Mark Engelberg mark.engelb...@gmail.comwrote: Does this OO pseudocode help clarify at all? https://gist.github.com/Engelberg/8142000 On Thu, Dec 26, 2013 at 6:27 PM, Stuart Halloway stuart.hallo...@gmail.com wrote: Hi Mark, I am not following your example. Can you post (pseudocode fine) what a good OO impl would look like, and why Clojure's defrecords can't do something similar? Stu -- -- 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/groups/opt_out.
Re: Is Clojure right for me?
On Dec 26, 2013, at 9:32 AM, Massimiliano Tomassoli kiuhn...@gmail.com wrote: Thank you, Malcolm. I'm completely new to LISP and its dialects and I'm a little bit worried about the absence of support for OOP in Clojure. How do you decompose large systems in Clojure? That seems like a very intelligent question. I didn't see that anyone in the thread mentioned Brian Marick's book, Functional Programming for the Object-Oriented Programmer. In the book, Marick emulates object-oriented programming in Clojure, which not only helps you see the greater flexibility you get with Clojure, but also helps you be a better OOP programmer when dealing with OOP languages. I'd definitely recommend the book. Another book worth checking out is Dmitri Sotnikov's Web Development with Clojure, which is a good survey of Clojure web development using Ring and Compojure. It illustrates well the idea of selecting the components you need for your web application and pulling them together, as opposed to the idea of a single overarching framework. I am a professional Rails developer and I like Rails. But I think the criticisms leveled against the single-framework model are very legitimate. If you want to do something the framework is not built for, you can spend a lot of time trying to work around the framework instead of using it. The easy things are really magically easy, but the hard things are pretty hard. Having said all that, here's what I really love about Clojure. Like Ruby and Rails, you can start off with an amorphous, ill-defined idea that you are prototyping. You can put it together, realize you had a lot of misconceptions (about the problem, the product, what people want, etc), and easily shift your assumptions. But Clojure shifts from Ruby and Rails when your idea matures and the invariants of your application settle. Clojure's tools give you more assurance of correctness when your app increasingly takes shape. Functional programming and immutability save you from whole classes of really fun state problems. Pure functions give you testability and transparency that are rarely seen in Rails apps. You can gradually add types to your arguments and return values (https://github.com/clojure/core.typed), thereby gaining much of the safety of statically-typed languages. You can use contracts (https://github.com/clojure/core.contracts) to ensure that your assumptions are always met, both regarding parameters and results of your functions. You can elegantly address all the possible cases of a set of parameters using matching (e.g. matchjure, https://github.com/dcolthorp/matchure/). Argument pattern-matching and destructuring is a fabulous tool and you really have to use it a little to realize how handy it is. In short, Clojure gives you all you need for prototyping, and when your idea jells out, you can tighten it down tremendously and expect fewer late-night phone calls where the app is breaking. Your software is simply more stable and correct, with less effort. Yet, you didn't have to pay the static-typing toll up front, when you needed the freedom and flexibility to try different things. I don't know if Clojure is ultimately right for you. But I can say with no doubt that learning Clojure will grow you as a software developer, and you won't be sorry you spent the time to get to know the language and the Clojure way of thinking. Good luck, steven -- -- 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/groups/opt_out.
Re: get rid of reflection in proxy-super?
On Thu, Dec 26, 2013 at 6:57 PM, Colin Fleming colin.mailingl...@gmail.comwrote: The problem is that your approach requires creating the proxy class with the method bodies actually compiled into the body of the proxy class method, they can't be in fns in a proxy map as they are now. This is ok in the case where a method body is just the proxy-super call, but most aren't - they call proxy-super as part of a much larger method. Changing that is a fundamental change to the way proxies work, and IMO would be better served by creating a new form (extend-class or something similar) which would behave in a more similar way to reify but would allow extension. If you read my previous post carefully, it says that *the proxy-super call* (if any) would need to go into the method body. Think something like this. Java: public class Whatever extends SomeClass { public int someMethod (int x, String y) { x = fred(x,42); int foo = super.someMethod(x, y); // someMethod protected in SomeClass return mumble(foo, thingy.frotz(x)); } } proxy (now) (byte code equivalent of): public class Whatever extends SomeClass { public MapString,IFn proxyMap = some longmessy initializer; public int someMethod (int x, String y) { return proxyMap.get(someMethod).invoke(this, x,y); } // And a similar thingy for each additional public-or-protected method in SomeClass } public class WhateverSomeMethodVersion1 implements IFn { public Object invoke (Whatever th1s, Object x, Object y) { x = th1s.fred((int)(Integer)x,42); int foo = Class.forName(SomeClass) .getMethod(someMethod, Integer.TYPE, String.class) .invoke(th1s, (int)(Integer)x, (String)y); // Eww, reflection, slow slow slow return th1s.mumble(foo, thingy.frotz((int)(Integer)x)); } } proxy (proposed) (byte code equivalent of): public class Whatever extends SomeClass { public MapString,IFn proxyMap = some longmessy initializer; public int proxySuperSomeMethod (Object x, Object y) { super.someMethod((int)(Integer)x, (String)y); // Needs .! or whatever to emit } // And a similar thingy for each additional protected method in SomeClass public int someMethod (int x, String y) { return proxyMap.get(someMethod).invoke(this, x,y); } // And a similar thingy for each additional public-or-protected method in SomeClass } public class WhateverSomeMethodVersion1 implements IFn { public Object invoke (Whatever th1s, Object x, Object y) { x = th1s.fred((int)(Integer)x,42); int foo = th1s.proxySuperSomeMethod(x, y); return th1s.mumble(foo, thingy.frotz((int)(Integer)x)); } } I've considered writing such a thing myself due to the limitations and idiosyncrasies of proxy/genclass but I've not investigated whether it's even possible without hacking the compiler - I suspect it's not. Not without implementing .! (or whatever name you prefer), or adding another bytecode emitter specialized to produce proxySuperSomeMethods. I guess every proxied class will need a proxy-hook subclass with -- -- 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/groups/opt_out.
Re: Is Clojure right for me?
On Thu, Dec 26, 2013 at 8:32 AM, Massimiliano Tomassoli kiuhn...@gmail.com wrote: Thank you, Malcolm. I'm completely new to LISP and its dialects and I'm a little bit worried about the absence of support for OOP in Clojure. I'm a little late to this thread (it's been one of those days!) but having read over your posts, I didn't get a good sense of why you are worried about the absence of support for OOP in Clojure? Like you, I have 20+ years of OOP experience - including eight years where I worked on the ANSI C++ Standards Committee - and I've worked with C++, Java, Groovy, Scala and a few other OOP languages during that time. I've developed and worked with static analysis tools and been able to look at millions of lines of code (mostly C++), and seen all sorts of horrors committed in the name of OOP :) Before that I worked on C and COBOL compilers, and various C and assembler projects. And before that I did FP, albeit in an academic context. For the last three years I've worked increasingly in Clojure. My team is slowly migrating from an OOP language and a 90Kloc system to Clojure (where we already have 16Kloc). Adjusting to FP from OOP can be hard - I've seen a number of Java developers really struggle with the transition. You might find Prof. Grossman's Programming Languages course (on Coursera) to be illuminating: it starts with Standard ML, then moves on to Racket, and then finishes with Ruby. Part of the course looks closely at what both FP and OOP bring to the table and how they can be viewed as complementary, orthogonal, and in some ways simply equivalent. How do you decompose large systems in Clojure? I'm curious as to why you think only OOP allows you to decompose large systems? Between namespaces, protocols, multimethods, ad hoc hierarchies, and higher order functions, Clojure has a lot of tools for organizing code... -- Sean A Corfield -- (904) 302-SEAN An Architect's View -- http://corfield.org/ World Singles, LLC. -- http://worldsingles.com/ Perfection is the enemy of the good. -- Gustave Flaubert, French realist novelist (1821-1880) -- -- 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/groups/opt_out.
Re: get rid of reflection in proxy-super?
I see. The problem is that you can't tell in advance which methods might be called with proxy-super, so you'd have to generate proxy-super methods for all non-public superclass methods. It's an interesting idea. I suspect it's a fairly tricky change since you'd have to change the method resolution for the dot form to cope with it, since currently it searches methods in the superclass - the proxy class is not available at compile time (actually, I'm not 100% sure on this, I'd need to check the code). Honestly, I think given that level of hackery and given the requirement to modify the compiler anyway, I'd go straight for a more sane extend-class form. On 27 December 2013 17:49, Cedric Greevey cgree...@gmail.com wrote: On Thu, Dec 26, 2013 at 6:57 PM, Colin Fleming colin.mailingl...@gmail.com wrote: The problem is that your approach requires creating the proxy class with the method bodies actually compiled into the body of the proxy class method, they can't be in fns in a proxy map as they are now. This is ok in the case where a method body is just the proxy-super call, but most aren't - they call proxy-super as part of a much larger method. Changing that is a fundamental change to the way proxies work, and IMO would be better served by creating a new form (extend-class or something similar) which would behave in a more similar way to reify but would allow extension. If you read my previous post carefully, it says that *the proxy-super call* (if any) would need to go into the method body. Think something like this. Java: public class Whatever extends SomeClass { public int someMethod (int x, String y) { x = fred(x,42); int foo = super.someMethod(x, y); // someMethod protected in SomeClass return mumble(foo, thingy.frotz(x)); } } proxy (now) (byte code equivalent of): public class Whatever extends SomeClass { public MapString,IFn proxyMap = some longmessy initializer; public int someMethod (int x, String y) { return proxyMap.get(someMethod).invoke(this, x,y); } // And a similar thingy for each additional public-or-protected method in SomeClass } public class WhateverSomeMethodVersion1 implements IFn { public Object invoke (Whatever th1s, Object x, Object y) { x = th1s.fred((int)(Integer)x,42); int foo = Class.forName(SomeClass) .getMethod(someMethod, Integer.TYPE, String.class) .invoke(th1s, (int)(Integer)x, (String)y); // Eww, reflection, slow slow slow return th1s.mumble(foo, thingy.frotz((int)(Integer)x)); } } proxy (proposed) (byte code equivalent of): public class Whatever extends SomeClass { public MapString,IFn proxyMap = some longmessy initializer; public int proxySuperSomeMethod (Object x, Object y) { super.someMethod((int)(Integer)x, (String)y); // Needs .! or whatever to emit } // And a similar thingy for each additional protected method in SomeClass public int someMethod (int x, String y) { return proxyMap.get(someMethod).invoke(this, x,y); } // And a similar thingy for each additional public-or-protected method in SomeClass } public class WhateverSomeMethodVersion1 implements IFn { public Object invoke (Whatever th1s, Object x, Object y) { x = th1s.fred((int)(Integer)x,42); int foo = th1s.proxySuperSomeMethod(x, y); return th1s.mumble(foo, thingy.frotz((int)(Integer)x)); } } I've considered writing such a thing myself due to the limitations and idiosyncrasies of proxy/genclass but I've not investigated whether it's even possible without hacking the compiler - I suspect it's not. Not without implementing .! (or whatever name you prefer), or adding another bytecode emitter specialized to produce proxySuperSomeMethods. I guess every proxied class will need a proxy-hook subclass with -- -- 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/groups/opt_out. -- -- 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