I was able to reproduce the failure in VirtualBox. It is really puzzling. @richiardiandrea ported some of clj code under self-host, but he forgot to port this one function: https://github.com/binaryage/env-config/blob/b8f6484073c37719cfb73be1b109ff1f9232f45f/src/lib/env_config/impl/helpers.cljc#L25 for some reason planck does not complain, neither lumo does
I don’t understand why it works in lumo and in planck on other systems than Ubuntu 14.04 (trusty)
@darwin env-config
s unit test work for me with Planck in Ubuntu 14.04
vagrant@vagrant-ubuntu-trusty-64:~/env-config$ uname -a
Linux vagrant-ubuntu-trusty-64 3.13.0-112-generic #159-Ubuntu SMP Fri Mar 3 15:26:07 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
vagrant@vagrant-ubuntu-trusty-64:~/env-config$ lein with-profile +self-host tach planck self-host-test-build
Testing env-config.tests.main
Ran 4 tests containing 16 assertions.
0 failures, 0 errors.
Error encountered performing task 'tach' with profile(s): 'base,system,user,provided,dev,self-host'
Suppressed exit
@mfikes thanks for trying, let me point you to some older tip of the branch, I have fixed it since my original posts
this one is broken: https://github.com/binaryage/env-config/tree/b8f6484073c37719cfb73be1b109ff1f9232f45f
this might be also related to java/clojure/webkit versions, maybe?
@darwin Oh. And the core of the failure is that Planck (and Lumo) fails to emit a diagnostic for the missing string-starts-with?
I'll clone that version and take a peek
there are probably two issues: first that inconsistency between plancks on different systems should be tracked down, and second why both planck and lumo were silent on some systems
the fact that tests passed might be just a coincidence, the function probably always returned true
in that invalid case and my tests never test false
case
Interestingly, I get it to fail for that older tip in the same way on OS X (10.10 Yosemite)
interesting, btw. I also tested it under Ubuntu 16.04 and it passed all tests there (silently)(
@darwin I know why Planck behaves differently on different platforms. JavaScriptCore evolved and at some point added .startsWith
. I encountered the same inconsistency with Andare https://github.com/mfikes/andare/issues/1
So if you try (.startsWith "abc" "a")
in Planck it might fail or work, depending on how old JavaScriptCore is.
I see, makes sense
unrelated question, do you have any trick how to write portable try-catch code?
my problem is (try ... (catch #?(:clj Throwable :cljs js/Error) e …)
No, Bloom suggested :default
for Clojure. There is a JIRA on the books for it.
yep, that would help
I wanted to help myself with a small macro, but that didn’t fly
catch is part of try-catch special form and I cannot write a macro just for catch part
Ahh, right
something like (catch-all e …)
would expand to (catch #?(:clj Throwable :cljs js/Error) e …)
I would have to write smart macro expanding whole try-catch form
Yeah, that's a tricky one
and that is a lot of work I’m not going to do right now, aren’t you aware of some library trying to ease writing portable code?
I don’t like how reader conditionals sprinkled in the middle of my code look 😉
I suppose if you are the one throwing, you always use ex-info
to at least have some consistency there.
I wonder if you can reliably catch that one in the same way portably