Re: [ClojureScript] Improving cljs.closure :none vs other

2014-01-02 Thread Thomas Heller
Now if I could only convince everyone that closure JSModules should be used always since they are way more flexible. @david: I'll look into creating a patch but unfortunately I realized that cljs.closure is missing the extra part that you currently don't define main namespaces and everything

Re: [ClojureScript] Improving cljs.closure :none vs other

2014-02-13 Thread Thomas Heller
On Tuesday, February 11, 2014 12:20:53 PM UTC+1, dead...@gmail.com wrote: Hello Thomas, sorry for bringing up this old topic, but having endured hours of frustration while trying to configure a build as a recent clojurescript adopter, I got curious how you are using closure JSModules?

Re: [ClojureScript] are Vars available for macros? Println from macros?

2014-05-31 Thread Thomas Heller
Hey, not sure what you are trying to achieve, since the compiler should already warn you if a var is not found. Might not do so when nesting defs. def/defn are top level forms und should not be nested, especially no def in a defn. As for your question: the CLJS compiler supports vars in

[ClojureScript] Compilation failures

2014-06-30 Thread Thomas Heller
Your project.clj is missing a closing paren ), thats why you are getting the EOF error with lein. HTH -- Note that posts from new members are moderated - please be patient with your first post. --- You received this message because you are subscribed to the Google Groups ClojureScript

[ClojureScript] Re: pr-str and #{} sets

2014-07-06 Thread Thomas Heller
On Saturday, July 5, 2014 9:53:33 PM UTC+2, Andrew Nguyen wrote: I am using a combination of pr-str cljs.reader/read-string to communicate between the front and backends. Everything has been working as expected but I'm now trying to send data that contains a clojure set and pr-str seems to

[ClojureScript] Re: Understanding Dead Code Elimination

2014-07-14 Thread Thomas Heller
I've got no compiler-fu to speak of but the increase in size is due to schema.core defining a lot of Protocols/Types on native types. They are checked at runtime and therefore require basically the rest of cljs.core (I guess). But I wouldn't worry about it, the size is due to cljs.core

[ClojureScript] Re: goog undefined error from clojurescript version 2197 and up

2014-07-16 Thread Thomas Heller
Hey, didn't try to reproduce with your example, but I know the cause. ;) http://dev.clojure.org/jira/browse/CLJS-826 goog is undefined cause the third party goog/base.js is used which just contains // This is a dummy file to trick genjsdeps into doing the right thing. // TODO(nicksantos): fix

Re: [ClojureScript] Re: goog undefined error from clojurescript version 2197 and up

2014-07-16 Thread Thomas Heller
Excellent. Thanks! /thomas -- Note that posts from new members are moderated - please be patient with your first post. --- You received this message because you are subscribed to the Google Groups ClojureScript group. To unsubscribe from this group and stop receiving emails from it, send an

[ClojureScript] Re: Trying to compile calls to new google analytics API fails with advanced compilation

2014-07-17 Thread Thomas Heller
Hey, the problem is not that closure munges the window.ga function, it is that closure creates a var named ga which can be anything but is not the analytics ga. At least it was in my case. My solution was to use the renaming feature of the analytics snippet to use a name closure won't

[ClojureScript] Re: Uncaught Error: Assert failed: No more than 1024 pending puts are allowed on a single channel.

2014-07-17 Thread Thomas Heller
Not an Om user here but sounds like you are receiving messages faster than you can handle them. A slow consumer is a common problem in a messaging situation and core.async has 2 built-in ways to deal with that. You can either use (async/chan (async/slliding-buffer n)) or (async/dropping-buffer

[ClojureScript] Re: ANN: ClojureScript 0.0-2277

2014-07-26 Thread Thomas Heller
Hey David, CLJS-826 is only partly resolved in this release since it only takes effect with a new closure-third-party release since the current jar is causing the problem. Would be nice if you could build a new closure release and bump the dependency in clojurescript. Thanks, /thomas On

[ClojureScript] Keyword Hashing

2014-07-28 Thread Thomas Heller
Hey, I'm running into alot of java.lang.IllegalArgumentException: Duplicate key: :display-as at clojure.lang.PersistentHashMap.createWithCheck(PersistentHashMap.java:67) at clojure.lang.RT.map(RT.java:1462) at clojure.lang.EdnReader$MapReader.invoke(EdnReader.java:631)

[ClojureScript] Re: Script tags in Html for different environments

2014-07-28 Thread Thomas Heller
Hey, if you are feeling adventurous you could try https://github.com/thheller/shadow-build, it is an alternate build library to lein-cljsbuild that I wrote that doesn't have that problem. But its quite alot more complicated to get started compared to lein-cljsbuild, never tried figwheel so

Re: [ClojureScript] Keyword Hashing

2014-07-28 Thread Thomas Heller
On Mon, Jul 28, 2014 at 8:16 AM, Thomas Heller th.hel...@gmail.com wrote: Hey, I'm running into alot of java.lang.IllegalArgumentException: Duplicate key: :display-as at clojure.lang.PersistentHashMap.createWithCheck(PersistentHashMap.java:67

Re: [ClojureScript] Keyword Hashing

2014-07-29 Thread Thomas Heller
Yes, I'm only testing Safari on iOS. Which looking at my logs seems to be the only one affected. Only Mobile Safari User Agents were sending maps with duplicate keys. No luck producing a more compact example though. -- Note that posts from new members are moderated - please be patient with

Re: [ClojureScript] Keyword Hashing

2014-07-29 Thread Thomas Heller
Created a patch to address that :emit-constants issue. http://dev.clojure.org/jira/browse/CLJS-829 Can't say wether its related to the issue at hand but less duplicate code is always good. -- Note that posts from new members are moderated - please be patient with your first post. --- You

Re: [ClojureScript] Re: ANN: ClojureScript 0.0-2277

2014-07-29 Thread Thomas Heller
wrote: Just add sonatype to your :repositories project.clj entry https://github.com/technomancy/leiningen/blob/master/sample.project.clj#L79 David On Tue, Jul 29, 2014 at 4:22 PM, Thomas Heller th.h...@gmail.com javascript: wrote: Uhm small hint on how I'd do that? My maven-fu is weak

Re: [ClojureScript] Re: ANN: ClojureScript 0.0-2277

2014-07-30 Thread Thomas Heller
David its probably best to hold off on that release. It seems the closure-library HEAD version depends on a newer closure compiler version than the one available via maven. At least I'm seeing some renaming issues for advanced compilation. -- Note that posts from new members are moderated -

[ClojureScript] Re: ANN: ClojureScript 0.0-2277

2014-07-30 Thread Thomas Heller
Sorry, I would be if I could. Trying to track it down, but debugging an optimized build is not exactly easy. :( When using 2277 I have no errors, when using 2277 with the new closure lib release I have some undefined errors. That usually means some sort of renaming gone wrong. Error: Cannot

[ClojureScript] Re: ANN: ClojureScript 0.0-2277

2014-07-30 Thread Thomas Heller
Geez, 2277 actually works just fine. 2234 doesn't work, but it actually doesn't work with either closure-library version. Forgot that I reverted to 2234 due to the keyword issue. 2277 + [org.clojure/google-closure-library 0.0-20140718-946a7d39] seems fine, except for that keyword issue. Sorry

Re: [ClojureScript] Re: ANN: ClojureScript 0.0-2277

2014-07-30 Thread Thomas Heller
, Jul 30, 2014 at 11:11 AM, Thomas Heller th.h...@gmail.com javascript: wrote: Geez, 2277 actually works just fine. 2234 doesn't work, but it actually doesn't work with either closure-library version. Forgot that I reverted to 2234 due to the keyword issue. 2277 + [org.clojure/google

[ClojureScript] Re: How to catch exceptions that occur inside a go block

2014-08-24 Thread Thomas Heller
Since a go block is async you cannot try/catch from outside. You need to either try/catch inside the block and return the exception as the result of the go block or use an extra channel to handle errors. (def errors (async/chan)) ;; exception handler (go (loop [] (when-let [ex (!

[ClojureScript] Re: cljs compiler implementation of function call

2014-09-10 Thread Thomas Heller
On Tuesday, September 9, 2014 11:06:07 AM UTC+2, Yehonathan Sharvit wrote: I am wondering why the cljs compiler emits code that calls functions using call and not straight js function call. for instance:  (defn foo []) (foo) is compiled to: user.foo = function() {   return

[ClojureScript] Re: Newbie advice on cljs + om?

2014-10-20 Thread Thomas Heller
As the author of shadow-build [1] and shadow [2] I'm obviously a bit biased on what to use on the CLJS side of things so I'll skip that part. As for CSS and other static assets (images, fonts, ...) I found it is best to make it a build/compile step and deploy it seperately from the application.

[ClojureScript] Re: ClojureScript Browser REPL and Advanced Optimizations

2014-11-05 Thread Thomas Heller
In general the REPL is the development feature and advanced compilation is for production quality builds. I do not think it is possible (or even a good idea) to use a REPL with optimized builds as they do not allow for any kind of incremental updates. HTH, /thomas On Wednesday, November 5,

[ClojureScript] Re: javascript to clojurescript transpiler

2014-11-08 Thread Thomas Heller
On Friday, November 7, 2014 12:24:36 AM UTC+1, Tom Connors wrote: I've got a project right now that uses javascript on the client and server and I'd love to be able to migrate to clojurescript. I'm wondering whether anyone is aware of any software that will transform the js into

[ClojureScript] Re: Password field issue inside a form in firefox

2014-11-09 Thread Thomas Heller
My guess would be autocomplete, stored in your browser. You can try (dom/input #js {:type password :id test-password :autocomplete off}). HTH, /thomas -- Note that posts from new members are moderated - please be patient with your first post. --- You received this message because you are

[ClojureScript] Re: alts!! (and alt!!) still make sense in CLJS when a :default is specified

2014-11-10 Thread Thomas Heller
That is a limitation of Javascript not core.async. Since you cannot block in Javascript (only one thread) you have to take the callback/async route for everything. Emulating blocking by running a loop is a bad idea since you cannot even pause/sleep and while that loop is running nothing else

[ClojureScript] Re: Standard way to provide externs for library authors

2014-11-10 Thread Thomas Heller
, not my user code. So, if library author thinks his library needs externs, he specifies it and packs externs along with library code, and they’re automatically used when I add dependency. So as a user I don’t manage external deps’ externs at all. As Thomas Heller puts it, it might

[ClojureScript] Re: Enforce a source file to be compiled first

2014-11-10 Thread Thomas Heller
That SHOULD be handled via the dependency graph of your namespaces, that means if one namespace requires code from another to be loaded it should list it in its (:require ...) declaration. This way you ensure that it was loaded in the right order. init.cljs: (ns init) (enable-console-print!)

Re: [ClojureScript] Re: Enforce a source file to be compiled first

2014-11-11 Thread Thomas Heller
Yes, but I would recommend using the require. It is much cleaner from the dependency graph perspective and tooling can support you way better. Also it is not that much work, maybe a couple seconds. I also tend to have a util namespace with general helper functions which is a good fit for the

Re: [ClojureScript] Standard way to provide externs for library authors

2014-11-18 Thread Thomas Heller
Hey, had a bit of time thinking about things. deps.cljs seems like a band aid to be honest, it might be better than without but I imagine we run into all sorts of issues in the future. In my projects I use CodeMirror quite frequently with a handcrafted (sort of incomplete) externs.js. To get

[ClojureScript] Re: Standard way to provide externs for library authors

2014-11-19 Thread Thomas Heller
Well yes, the compiler only needs to produce .js from .cljs. The second phase is packaging everything together, this is where Closure kicks in. That part needs externs, preamble and the like. I would agree that does not need to be in ClojureScript itself, the whole Closure part ist not

Re: [ClojureScript] [ANN] shin — ClojureScript implementation in Ruby minus the JVM Google Closure parts

2014-12-02 Thread Thomas Heller
Hey, good luck with your efforts. It seems to be that is was motivated by alot of frustration due to lein-cljsbuild and Google Closure. Most of the issues mentioned in S-exps in your browser are actually addressed in shadow-build [1], part of the reason I wrote it due to some frustrations I

[ClojureScript] [ANN] shadow-build 1.0.0-alpha1, now beginner friendly

2014-12-03 Thread Thomas Heller
Hello everyone, shadow-build picked up some users of the past few months which is great, but I still consider it way too hard to use for beginners. I now included some default build configurations to make it easier to get started and basically provide what lein-cljsbuild offers. Out of the

[ClojureScript] [ANN] shadow-build 1.0.0-alpha2, now with live-reload (ala lein-figwheel)

2014-12-06 Thread Thomas Heller
Hello again, I added basic live reloading of js (ala lein-fighwheel) to the default build-dev configuration of shadow-build. I updated the example project to include this feature. See: https://github.com/thheller/shadow-build-example

[ClojureScript] Re: Defining defmethod used at macroexpansion time

2014-12-07 Thread Thomas Heller
Hey, I'm honestly not quite sure what you are asking but maybe I can shed some light on the way the ClojureScript compiler handles Clojure code (ie. macros). Whenever the cljs.analyzer reads a (ns ...) form and encounters anything that mentions a macro, like (:require-macros [some.ns :refer

Re: [ClojureScript] Re: [ANN] Hipo 0.2.0 - a DOM templating library based on hiccup syntax

2014-12-10 Thread Thomas Heller
I got curious, think I found a way to get closer to the macro. Only does element contruction no attributes are set except id/className but that happens later anyways. Uses element.cloneNode https://gist.github.com/thheller/7faf1c28ca14c9865376 See the related js-perf (not by me)

[ClojureScript] Re: Possible require duplication issue with optimizations :none?

2014-12-14 Thread Thomas Heller
I noticed this a while back [1]. I ended up not caring anymore since it doesn't hurt and is removed by :advanced anyways. FWIW it is caused by the alias (:require [clojure.string :as str]) which ends with goog.require for 'clojure.string and 'str (which resolves to 'clojure.string). Without an

[ClojureScript] Re: cljsbuild/closure compiler options

2014-12-24 Thread Thomas Heller
Hey, I just looked at the warnings code and it seems like a mistake that disabling one warning actually disables 3 by accident. Anyways, the warning definitions [1] are all pretty self explanatory, more so if you look at the actual text the produce in the error functions below [1]. You could

[ClojureScript] Re: Updating sorted set inside go block

2014-12-24 Thread Thomas Heller
Cannot say without the rest of the code but I what is in (:transformations resp)? sorted-set doesn't work if one item doesn't compare to another (eg. numbers vs maps). Suppose: (def a (atom #{})) = (var user/a) (reset! a (into (sorted-set) [1 2 2 2 3])) = #{1 2 3} (conj @a {:name test})

[ClojureScript] Re: Updating sorted set inside go block

2014-12-24 Thread Thomas Heller
instead). Best Regards, Sven Am Mittwoch, 24. Dezember 2014 14:23:35 UTC+1 schrieb Thomas Heller: Cannot say without the rest of the code but I what is in (:transformations resp)? sorted-set doesn't work if one item doesn't compare to another (eg. numbers vs maps). Suppose

[ClojureScript] Re: Updating sorted set inside go block

2014-12-25 Thread Thomas Heller
outside of the go block always work, no matter if it is a set or not. If it's still hard to follow I might put together a small example. Best Regards, Sven Am Mittwoch, 24. Dezember 2014 22:14:02 UTC+1 schrieb Thomas Heller: That code doesn't help much either since there is still

[ClojureScript] Re: Updating sorted set inside go block

2014-12-25 Thread Thomas Heller
UTC+1 schrieb Thomas Heller: Hey, I figured it out. Fun puzzle. ;) As expected core.async is not the real villain here, the behavior sure is odd but I'm not sure it is a bug. The issue is that {:name test} inside a go block always gets turned into a hash-map, while outside

[ClojureScript] The Future of ClojureScript Tools

2014-12-30 Thread Thomas Heller
Hey, First of all, huge thanks to David Nolen for all your work on ClojureScript. TL;DR: I want to help, but I'm sort of stuck. With all the recent CLJS commits going into tooling related issues (cljs.test, caching, ...) I find a lot of overlap to what I have done in shadow-build. I either

Re: [ClojureScript] The Future of ClojureScript Tools

2014-12-30 Thread Thomas Heller
On Wednesday, December 31, 2014 12:17:11 AM UTC+1, David Nolen wrote: Supporting both Node.js and the Browser has been a goal since the initial release. There's nothing new going on here except more better. What is tooling and what is CLJS? At which point does it make sense to address an

[ClojureScript] Re: How to integrate clojurescript macros into the build

2015-01-03 Thread Thomas Heller
Can you run this? lein repl (require 'pts.macros) If not you are probably missing a classpath entry since macros have to be on the classpath for Clojurescript (Clojure) to find them. Your project should have (defproject ... :source-paths [src/clj] :cljsbuild {:source-paths [src/cljs]})

Re: [ClojureScript] Re: Need help with advanced optimization

2015-01-30 Thread Thomas Heller
in both dev and prod? Because when I set them the same, I get this when trying the prod build: Error encountered performing task 'cljsbuild' with profile(s): 'prod' java.lang.Exception: All [:compiler :output-dir] options must be distinct. On Fri, Jan 30, 2015 at 10:21 AM, Thomas Heller

[ClojureScript] Re: Path names in :advanced compile

2015-02-03 Thread Thomas Heller
Can you look at the pre-optimized js sources and grep for that string? It might be a macro of a library. Hard to tell without knowing what that thing actually is. It looks like something var-ish (ie. :line, :column, :file, ...). Anyways look at the js files to see the full context, should make

[ClojureScript] Re: Using `not` for keywords

2015-01-15 Thread Thomas Heller
Boolean is not a protocol. It is a native datatype, just like in Clojure. -- Note that posts from new members are moderated - please be patient with your first post. --- You received this message because you are subscribed to the Google Groups ClojureScript group. To unsubscribe from this

[ClojureScript] Re: Using `not` for keywords

2015-01-15 Thread Thomas Heller
On Thursday, January 15, 2015 at 5:08:27 PM UTC+1, Yehonathan Sharvit wrote: Because in my app , it is clearer from a semantic point of view, it is clearer as the value stands for a question asked to the user. How about (ns my-ns.util) (def YES true) (def NO false) (ns my-ns (:use

Re: [ClojureScript] Trying out the new :modules support

2015-02-18 Thread Thomas Heller
That is probably dead code removal in action. Since none of your code is actually called it all will be removed. :) Try to ^:export a function that will keep it from getting removed or just call one of the functions. (ns com.foo.editor (:require [com.foo.common :refer (blah)])) (defn

[ClojureScript] How do you / would you like to test?

2015-01-27 Thread Thomas Heller
Hello everyone, I recently started working in adding support for testing in shadow-build. I have my own testing workflow but wanted to ask how everyone else does it? ClojureScript AND Clojure because I'd like them to be as close as possible. My CLJ workflow is opening a REPL and use Run test

[ClojureScript] Re: [ANN] CLJSJS

2015-01-06 Thread Thomas Heller
FWIW there is absolutely no need to ship a production/development version of the code. The Closure Compiler is perfectly capable of minifying any JS source (NOT advanced optimize, just minify). Therefore the full JS + externs would be enough. As a build tool author I don't quite agree with

Re: [ClojureScript] Re: [ANN] CLJSJS

2015-01-06 Thread Thomas Heller
That's right but for some projects the assumption that .min.js means minified is just not true. E.g. React ships with different logging levels enabled based on wether you're including the development or production build. I'm sure there are more projects that include extra debugging stuff

Re: [ClojureScript] Mac OS X Classpath issue in Getting Started?

2015-03-19 Thread Thomas Heller
Caused by: java.io.FileNotFoundException: Could not locate cljs/closure'__init.class or cljs/closure'.clj on classpath: Is it possible you are trying (require 'cljs.closure')? That trailing ' should otherwise not be there. ' means quote in Clojure and is not a String. -- Note that posts

[ClojureScript] Re: Detecting :target :nodejs

2015-03-10 Thread Thomas Heller
IMHO that is not something you should handle at compile time. I would suggest creating a proper API and a main namespace that serves as an entry point to your application and configures it before starting. For example: (ns my-app.log) (defprotocol ILog (-log [this msg])) (def logger (atom

[ClojureScript] Re: dependency ordering without :modules?

2015-03-13 Thread Thomas Heller
On Friday, March 13, 2015 at 6:19:29 PM UTC+1, Tyler Solomon wrote: Thanks, I will have a look at shadow-build. Am I correct to say that the root of my difficulty is google closure-compiler not supporting modules in any compilation level below `simple`? Potentially relevant link:

[ClojureScript] Re: dependency ordering without :modules?

2015-03-13 Thread Thomas Heller
You should have a main namespace where your app is started and this namespace should require all component namespaces you are going to use. (ns project.main (:require [project.components.contacts])) (start-the-app) This way you ensure that all your namespaces are loaded in the proper order

[ClojureScript] Re: dependency ordering without :modules?

2015-03-13 Thread Thomas Heller
On Friday, March 13, 2015 at 4:10:04 PM UTC+1, Tyler Solomon wrote: I think perhaps you have already given me the answer, but I do not see it. I should require all of the component namespaces so they are available when rendering the root of application. Later when the code is split for

[ClojureScript] Re: Macros and type hints

2015-03-24 Thread Thomas Heller
Question: why exactly is this type hint needed when js/goog.DEBUG is used in an if? As far as I can see, js/goog.DEBUG is a boolean already. Short answer: We don't evaluate or parse any Javascript when compiling ClojureScript. That means we don't know about goog.DEBUG and what type it

[ClojureScript] Re: Clojurescript Protocol Usage

2015-03-26 Thread Thomas Heller
The general advice is to use Protocols if you need more than one implementation of a function (ie. different targets). If there is only one, use a function. I found myself always starting with a simple function and eventually refactor to a protocol if needed (which is quite rare). It is

Re: [ClojureScript] Re: What is the up to date summary of cljs macro definition/usage as of 2850?

2015-03-02 Thread Thomas Heller
You are going to need to talk to David Nolen about that. He decided that this should be handled in a separate issue than [1]. The implementation in shadow-build [2] (and my original patch) properly support :refer but I currently do not have the time to create a revised issue/patch for CLJS

Re: [ClojureScript] Re: What is the up to date summary of cljs macro definition/usage as of 2850?

2015-02-26 Thread Thomas Heller
If you change it to ;; In src/cljs/fancy/fancy.cljs: (ns fancy.fancy (:require-macros [fancy.fancy :as m]) ;; In src/cljs/fancy/core.cljs: (ns fancy.core (:require [fancy.fancy :as fancy])) (fancy/fun 123) should then always equal the macro version (unless you use apply). The

[ClojureScript] Re: Need help with advanced optimization

2015-01-30 Thread Thomas Heller
1) The main js file is empty because of the closure compiler error. The circular dependency is somewhere in your code, usually :none should detect it as well but difficult to tell without the source. 2) I do not think the cljsbuild config should be in a profile. https://www.refheap.com/96682

Re: [ClojureScript] cljs compiler options :closure-defines {:goog.DEBUG false}

2015-05-05 Thread Thomas Heller
http://dev.clojure.org/jira/browse/CLJS-1014 makes me think that defines should work in :none, not sure why they don't. If you want to use Closure defines in :none while developing you can put them into your HTML manually before including the javascript (or use shadow-build). For standard CLJS

[ClojureScript] Re: cljs compiler options :closure-defines {:goog.DEBUG false}

2015-05-04 Thread Thomas Heller
No idea if this is still current but closure defines only used to work in anything but :optimizations :none. Are you testing in :none? On Tuesday, May 5, 2015 at 12:13:12 AM UTC+2, Jamie Orchard-Hays wrote: Can't figure out what I'm doing wrong here: project.clj: {:compiler

[ClojureScript] Re: Using Google Closure-compatible JS files in CLJS project

2015-04-13 Thread Thomas Heller
If you feel like trying a new build setup you could try shadow-build [1,2]. None of this should be an issue with it and :libs is not required, just make sure the .js files are in some listed source path and the rest should just work. Might have a whole lot of other issues though so YMMV. ;)

[ClojureScript] Re: Closure locale

2015-04-09 Thread Thomas Heller
Been a while since I used that stuff, so I'm just guessing. Are you on :none? IIRC cljs only supports defines in anything higher than :none. You can however include scriptCLOSURE_DEFINES={'goog.LOCALE':'de'};/script in your HTML BEFORE including any other javascript. Pretty sure the locale is

[ClojureScript] Re: [ANN] cljs-pikaday, a reagent date picker

2015-04-05 Thread Thomas Heller
, so that's another nudge in the Closure direction. Also, thanks for publishing those demos, they are quite helpful. Tim On Sunday, April 5, 2015 at 6:05:00 AM UTC-4, Thomas Heller wrote: Hey Tim, I have no real feedback for you since I don't use Reagent or Om but thought I

[ClojureScript] Re: [ANN] cljs-pikaday, a reagent date picker

2015-04-05 Thread Thomas Heller
On Monday, April 6, 2015 at 12:11:28 AM UTC+2, Shaun Mahood wrote: Thomas, have you got any good resources for working with Closure in Cljs? I've tried to figure it out and read a decent amount but have found it difficult to get the hang of. Apart from the docs I linked not really. The demos

[ClojureScript] Re: [ANN] cljs-pikaday, a reagent date picker

2015-04-05 Thread Thomas Heller
Hey Tim, I have no real feedback for you since I don't use Reagent or Om but thought I should mention that it might be better to leverage what the Closure Library has to offer before grabbing external Javascript. The Closure Library comes with a full fledged DatePicker that is fully

[ClojureScript] Re: Let bindings not resolved in go block

2015-04-02 Thread Thomas Heller
I think you are using the wrong (async/go ...). Make sure it is (cljs.core.async.macros/go ...) not (clojure.core.async/go ...). On Thursday, April 2, 2015 at 8:14:07 PM UTC+2, Chris Perkins wrote: I'm having trouble with this macro, and wondering whether I am doing something wrong:

[ClojureScript] Re: Compiling multiple apps from single source tree/debugging closure advanced mode

2015-06-08 Thread Thomas Heller
Hey, you could take a look at shadow-build [1]. I wrote it for exactly the use case you describe since I had that issue myself. CLJS itself will always include all source files it can find in a build which leads to your issues. shadow-build will also discover all source files but will only

[ClojureScript] Re: How can I import this foreign lib.

2015-10-30 Thread Thomas Heller
This is very likely to break :advanced optimisations, did you test that yet? Probably not what you are looking for but there is a "goog.ui.Textarea" [1,2] in the closure library which does the auto-sizing as well. Should be pretty straighforward to make a react-wrapper for it. HTH, /thomas

[ClojureScript] Re: How can I import this foreign lib.

2015-10-30 Thread Thomas Heller
know is what > is best for ClojureScript. > > Thanks in advance, Leon. > > > On Friday, October 30, 2015 at 9:54:01 AM UTC+1, Thomas Heller wrote: > > This is very likely to break :advanced optimisations, did you test that yet? > > > > Probably not what you

Re: [ClojureScript] Re: Clojurescript async not yeilding for CPU intensive work

2015-08-26 Thread Thomas Heller
Well, while we are on the topic perhaps we should mention the downside of using Web Workers. For me it has been Data Transfer. Since you can only transfer JSON type data between workers that usually meant you had to pr-str/read-string to roundtrip CLJS data. If you only have very small amounts

[ClojureScript] Re: Clojurescript async not yeilding for CPU intensive work

2015-08-25 Thread Thomas Heller
This has nothing to do with core.async or the go macro. If you block the CPU you will block the UI. The browser does not support threads so neither can core.async. What the timeout achieves is that you give some control back to the browser so instead of 1sec blocking you get 5x200ms blocking.

Re: [ClojureScript] Re: Clojurescript async not yeilding for CPU intensive work

2015-08-26 Thread Thomas Heller
On Wednesday, August 26, 2015 at 1:29:38 PM UTC+2, Daniel Kersten wrote: If you can use newer browser, you've got Transferrable Object to transfer binary data with zero-copy.   True but I was talking about CLJS data which isn't binary. Agreed, its probably a bit of work. I guess that

Re: [ClojureScript] Re: Clojurescript async not yeilding for CPU intensive work

2015-08-25 Thread Thomas Heller
On Tuesday, August 25, 2015 at 10:59:53 AM UTC+2, Daniel Kersten wrote: The browser does not support threads so neither can core.async. To expand on that, core.async uses cooperative multitasking, which means you have to give control back every so often so it can schedule other go blocks

Re: [ClojureScript] Extending protocol to an existing JavaScript type

2015-09-07 Thread Thomas Heller
For a little JavaScript WTF and one reason why things are the way the are: Number.prototype.whatAmI = function() { return typeof(this); }; var x = 1; x.whatAmI(); "object" typeof(x) "number" Fun times debugging that ... Cheers, /thomas -- Note that posts from new members are moderated -

Re: [ClojureScript] Extending protocol to an existing JavaScript type

2015-09-07 Thread Thomas Heller
> The point I wanted to make is 'this' without 'new' will refer to the object > the function is defined on be it 'window' or whatever object. > That is incorrect. "this" is the actual number, not window. new or not. Behavior is probably different for other types. ;) Number.prototype.addFive

Re: [ClojureScript] Extending protocol to an existing JavaScript type

2015-09-08 Thread Thomas Heller
Hmm I think you have those confused. Take the equivalent from Java: class MyClass { } MyClass x = new MyClass(); Class y = MyClass.class; or JS: var MyClass = function() { /* ctor */ }; var inst = new MyClass() inst != MyClass inst.prototype == MyClass inst is an instance of MyClass

[ClojureScript] Re: "Redirect-after-post" using secretary?

2015-09-12 Thread Thomas Heller
as I'm aware. You'll probably need to change the server side response. On Saturday, September 12, 2015 at 8:53:59 PM UTC+2, Hari Krishnan wrote: > On Saturday, September 12, 2015 at 2:11:31 AM UTC-7, Thomas Heller wrote: > > You are using an ajax request which does not follow the s

[ClojureScript] Re: "Redirect-after-post" using secretary?

2015-09-12 Thread Thomas Heller
You are using an ajax request which does not follow the same rules as a normal browser navigation requests. It will not follow redirects for example. I don't know what ajax lib you are using but the general solution will be: fire request wait for response check response code of request if

[ClojureScript] Re: My cljs app is too big! Please advise

2015-09-24 Thread Thomas Heller
Are you using whitespace optimization during development? You should really be using :none which usually means compilation times in milliseconds. Do you have any information on the kind of hardware the compile runs on? The numbers look horrible. Since you say heroku I imagine a VM in the Cloud

Re: [ClojureScript] google closure modules and the :main compiler option

2015-12-08 Thread Thomas Heller
On Tuesday, December 8, 2015 at 12:25:24 AM UTC+1, ewen wrote: > Would you also consider a patch to make the :main option to accept a > collection of namespaces? shadow-build is fine with that, expects it in fact. Not really sure why cljs allows multiple :entries per :module but :main only

[ClojureScript] Re: google closure modules and the :main compiler option

2015-12-07 Thread Thomas Heller
You can try shadow-build [1], one of my goals was to make switching between dev/prod as simple as possible without requiring any code/html changes. It also addresses some other things not related to modules but still helpful to make dev/production builds as smooth as possible. Docs are lacking

[ClojureScript] Re: Exporting UMD from ClojureScript library

2015-11-22 Thread Thomas Heller
Hey, my advice would be to use a post-process step instead of trying to making it go through the closure compiler. Not only will that produce headaches but the generated CLJS->JS also does not match the expected structure for UMD exports. You'd need to tag the functions you want to have

Re: [ClojureScript] Re: ClojureScript and multi-page website

2016-02-27 Thread Thomas Heller
If you want you can try shadow-build. It supports modules all the way (ie. :none). It has some figwheel-ish features (REPL, live-reload) but basically no documentation, so a little patience is required. It is pretty simple, just very different from other build tools. See:

[ClojureScript] Re: Will advanced optimizations be officially supported on nodejs?

2016-01-25 Thread Thomas Heller
Technically there is nothing holding you back from using :advanced on node, IF you supply all externs that is. And this is where the problem lies, you cannot easily provide externs since the closure compiler doesn't understand "require" properly. CloSure assumes there is one global namespace

[ClojureScript] Re: Overview of templates, ways of getting started?

2016-03-22 Thread Thomas Heller
https://github.com/clojure/clojurescript/wiki/Quick-Start should be done at least once, regardless of whether you are using a template or not. It helps clearing up a few things that need to be done in order to get a working setup. Templates make you skip this step but it is important to

[ClojureScript] Re: Self-hosting Clojurescript - :context is important

2016-04-26 Thread Thomas Heller
The :context basically tells the compiler if the return value is required (:statement vs. :expr). A :statement does not need to return something and "if" in javascript does not return something. If an "if" is compiled with :expr it generates (condition ? yes : no) instead of "if" for

[ClojureScript] Re: How to make cljs$core$next faster in ClojureScript?

2016-04-21 Thread Thomas Heller
Hey, the .cirru code looks quite foreign but I guess I can kinda see what is going on. cljs$core$next is probably not what is slow here, next when working on a lazy seq will realize the next entry. So while next is fast the actual work that happens is "slow". Flame Graphs are generally better

[ClojureScript] Re: basic conceptual question: clojurescript & core.async

2016-08-08 Thread Thomas Heller
You can have concurrency without parallelism. core.async is "A Clojure library designed to provide facilities for async programming and communication". Parallelism is just a bonus side-effect, but not required or even the goal. Reducers for example have the goal of parallelism over

[ClojureScript] Re: CSS in CLJS

2017-02-03 Thread Thomas Heller
FWIW I did a quick test to see if things worked with reagent. Turns out they do. Basically works out of the box: https://github.com/thheller/reagent-test The dependency on Clojure 1.9 was not intentional and I would remove it if anyone wants to use this with 1.8. Anyways feel free to clone the

[ClojureScript] CSS in CLJS

2017-02-02 Thread Thomas Heller
Hello, I'm not sure how many of you are in this horrible situation where you have to write CSS for your React Components. I typically have to write way more than I'd like and always hated the way I wrote it. Until a few weeks ago. I wrote this thing and so far I really like it. Too early to

[ClojureScript] Re: CSS in CLJS

2017-02-03 Thread Thomas Heller
As I said I haven't used garden, can't say how much of a difference there is. One thing I can't change is that selectors have to be strings, they are keywords in garden. The maps of css properties should be portable though and you shouldn't really need the selectors after? As for re-using css

Re: [ClojureScript] CSS in CLJS

2017-02-03 Thread Thomas Heller
I looked at garden but never used it. It seems like a direct alternative to SCSS/Less, but nothing more. The intent of shadow.markup (sorry, couldn't think of a better name yet) is that I basically never want to write a single selector ever again. There are several cases where this is still

[ClojureScript] Re: CSS in CLJS

2017-02-06 Thread Thomas Heller
> > Thanks got it. My mistake was mixing reagent's markup with yours. Would you > say this is an alternative, similar to how shadow.markup relates to om.dom? Yes. While I like the hiccup-ish reagent syntax it does present some performance issues. In reagent you first allocate a bunch of

  1   2   >