Re: [ClojureScript] Re: [ANN] Clojure 1.7.0-beta1 released

2015-04-13 Thread Andy Fingerhut
Your particular example is equivalent to #?(:clj) which is illegal, for the 
reason given in the error message you saw.

Normal Clojure comments are far less surprising in their behavior than #_ is

I understand there can be convenience in using #_ when it works.

Andy

Sent from my iPhone

> On Apr 13, 2015, at 12:38 PM, whodidthis  wrote:
> 
> 
> 
>> On Monday, April 13, 2015 at 4:48:28 PM UTC+3, Alex Miller wrote:
>> I think what you're seeing here makes sense.
>> 
>>> On Sunday, April 12, 2015 at 3:39:15 PM UTC-5, whodidthis wrote:
>>> Are there any thoughts on code like this:
>>> 
>>> #_
>> 
>> This says to ignore the next read form
>>  
>>> #?(:cljs (def unrelated-1 nil))
>> 
>> This evaluates to *nothing*, ie nothing is read, so it is not ignored by the 
>> #_.
>>  
>>> #?(:cljs (def unrelated-2 nil))
>>> #?(:cljs (def unrelated-3 nil))
>> 
>> These also read as *nothing*.
>>  
>>> #?(:clj (def n 10))
>> 
>> This *is* read, but ignored per the prior #_ 
>> 
>>> #?(:clj (defn num [] n))
>>> ; compile on clj =>RuntimeException: Unable to resolve symbol: n
>> 
>> And then this makes sense.
>>  
>>> 
>>> I guess it's fine if it continues to work that way but I can imagine it 
>>> being a little surprising from time to time heh
>> 
>> Conditional reading is definitely something to be careful about - I think in 
>> this case you are combining two types of conditional reading so be doubly 
>> careful. :) 
>> 
>> To get the effect you want in this, using #_ *inside* the reader conditional 
>> would work:
>> 
>> #?(:cljs #_(def unrelated-1 nil))
> 
> Sorry, back to this stuff again. I tried using discard inside but 
> 
> #?(:clj #_'whatever)
> 
> just throws
> 
> CompilerException java.lang.RuntimeException: read-cond starting on line 32 
> requires an even number of forms"
> 
> when compiling on clojure.
> 
> Would be nice to have a way to ignore reader conditional forms or the thingie 
> things inside but there does not seem to be an easy way.
> -- 
> Note that posts from new members are moderated - please be patient with your 
> first post.
> --- 
> You received this message because you are subscribed to the Google Groups 
> "ClojureScript" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to clojurescript+unsubscr...@googlegroups.com.
> To post to this group, send email to clojurescr...@googlegroups.com.
> Visit this group at http://groups.google.com/group/clojurescript.

-- 
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/d/optout.


Re: [ClojureScript] Re: [ANN] Clojure 1.7.0-beta1 released

2015-04-13 Thread Michał Marczyk
Just noticed that I sent my previous email to clojure-dev only – reposting
to all groups involved:

On 13 April 2015 at 16:25, Michał Marczyk  wrote:
> On 13 April 2015 at 15:48, Alex Miller  wrote:
> To get the effect you want in this, using #_ *inside* the reader
conditional would work:
>
> #?(:cljs #_(def unrelated-1 nil))
>
> Actually this doesn't work because of the cond-like structure of #?
conditionals:
>
> user=> (read-string {:read-cond :allow} "#?(:clj #_foo) bar")
> RuntimeException read-cond requires an even number of forms.
 clojure.lang.Util.runtimeException (Util.java:221)

To this I would add that it is possible to say

Clojure 1.7.0-beta1
user=> (read-string {:read-cond :allow} "#?(#_#_:clj foo) bar")
bar

taking advantage of the nice "stacking" property of #_ (which follows from
the recursive nature of the reader in the same way that the original
surprising case does).

Cheers,
Michał


On 13 April 2015 at 21:38, whodidthis  wrote:

>
>
> On Monday, April 13, 2015 at 4:48:28 PM UTC+3, Alex Miller wrote:
>>
>> I think what you're seeing here makes sense.
>>
>> On Sunday, April 12, 2015 at 3:39:15 PM UTC-5, whodidthis wrote:
>>>
>>> Are there any thoughts on code like this:
>>>
>>> #_
>>>
>>
>> This says to ignore the next read form
>>
>>
>>> #?(:cljs (def unrelated-1 nil))
>>>
>>
>> This evaluates to *nothing*, ie nothing is read, so it is not ignored by
>> the #_.
>>
>>
>>> #?(:cljs (def unrelated-2 nil))
>>> #?(:cljs (def unrelated-3 nil))
>>>
>>
>> These also read as *nothing*.
>>
>>
>>> #?(:clj (def n 10))
>>>
>>
>> This *is* read, but ignored per the prior #_
>>
>> #?(:clj (defn num [] n))
>>> ; compile on clj =>RuntimeException: Unable to resolve symbol: n
>>>
>>
>> And then this makes sense.
>>
>>
>>>
>>> I guess it's fine if it continues to work that way but I can imagine it
>>> being a little surprising from time to time heh
>>>
>>
>> Conditional reading is definitely something to be careful about - I think
>> in this case you are combining two types of conditional reading so be
>> doubly careful. :)
>>
>> To get the effect you want in this, using #_ *inside* the reader
>> conditional would work:
>>
>> #?(:cljs #_(def unrelated-1 nil))
>>
>
> Sorry, back to this stuff again. I tried using discard inside but
>
> #?(:clj #_'whatever)
>
> just throws
>
> CompilerException java.lang.RuntimeException: read-cond starting on line
> 32 requires an even number of forms"
>
> when compiling on clojure.
>
> Would be nice to have a way to ignore reader conditional forms or the
> thingie things inside but there does not seem to be an easy way.
>
> --
> Note that posts from new members are moderated - please be patient with
> your first post.
> ---
> You received this message because you are subscribed to the Google Groups
> "ClojureScript" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to clojurescript+unsubscr...@googlegroups.com.
> To post to this group, send email to clojurescr...@googlegroups.com.
> Visit this group at http://groups.google.com/group/clojurescript.
>

-- 
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/d/optout.


Re: [ClojureScript] Re: [ANN] Clojure 1.7.0-beta1 released

2015-04-13 Thread Daniel Kersten
Ouch! But that actually makes a lot of sense.

On Mon, 13 Apr 2015 14:58 Alex Miller  wrote:

> There is a ticket to consider a portable solution to this issue:
>
> http://dev.clojure.org/jira/browse/CLJ-1293
>
>
> On Monday, April 13, 2015 at 5:45:35 AM UTC-5, David Nolen wrote:
>
>> The only reason :default exists is because *anything* in JavaScript can
>> be thrown and there needs to be some way to catch non-Error derived values.
>> This is not the case for Java of course. :default could probably be aliased
>> to Throwable, but in the meantime differences like this are now handleable
>> via conditional reading.
>>
>> David
>>
>
>> On Mon, Apr 13, 2015 at 6:37 AM, Robin Heggelund Hansen <
>> skinn...@gmail.com> wrote:
>>
>>> Hmm... In Clojurescript you can do the following
>>>
>>> (try
>>>   ;; throw something
>>>   (catch :default e
>>>  e))
>>>
>>> When I try the same thing in Clojure, it seems to not be supported. Is
>>> there any plans to support this syntax in Clojure 1.7?
>>>
>>>
>>  --
> Note that posts from new members are moderated - please be patient with
> your first post.
> ---
> You received this message because you are subscribed to the Google Groups
> "ClojureScript" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to clojurescript+unsubscr...@googlegroups.com.
> To post to this group, send email to clojurescr...@googlegroups.com.
> Visit this group at http://groups.google.com/group/clojurescript.
>

-- 
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/d/optout.


Re: [ClojureScript] Re: [ANN] Clojure 1.7.0-beta1 released

2015-04-13 Thread Alex Miller
There is a ticket to consider a portable solution to this issue:

http://dev.clojure.org/jira/browse/CLJ-1293

On Monday, April 13, 2015 at 5:45:35 AM UTC-5, David Nolen wrote:
>
> The only reason :default exists is because *anything* in JavaScript can be 
> thrown and there needs to be some way to catch non-Error derived values. 
> This is not the case for Java of course. :default could probably be aliased 
> to Throwable, but in the meantime differences like this are now handleable 
> via conditional reading.
>
> David
>
> On Mon, Apr 13, 2015 at 6:37 AM, Robin Heggelund Hansen <
> skinn...@gmail.com > wrote:
>
>> Hmm... In Clojurescript you can do the following
>>
>> (try
>>   ;; throw something
>>   (catch :default e
>>  e))
>>
>> When I try the same thing in Clojure, it seems to not be supported. Is 
>> there any plans to support this syntax in Clojure 1.7?
>>
>>
>

-- 
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/d/optout.


Re: [ClojureScript] Re: [ANN] Clojure 1.7.0-beta1 released

2015-04-13 Thread Robin Heggelund Hansen
Ahh ok, makes sense.

mandag 13. april 2015 12.45.35 UTC+2 skrev David Nolen følgende:
>
> The only reason :default exists is because *anything* in JavaScript can be 
> thrown and there needs to be some way to catch non-Error derived values. 
> This is not the case for Java of course. :default could probably be aliased 
> to Throwable, but in the meantime differences like this are now handleable 
> via conditional reading.
>
> David
>
> On Mon, Apr 13, 2015 at 6:37 AM, Robin Heggelund Hansen <
> skinn...@gmail.com > wrote:
>
>> Hmm... In Clojurescript you can do the following
>>
>> (try
>>   ;; throw something
>>   (catch :default e
>>  e))
>>
>> When I try the same thing in Clojure, it seems to not be supported. Is 
>> there any plans to support this syntax in Clojure 1.7?
>>
>> -- 
>> Note that posts from new members are moderated - please be patient with 
>> your first post.
>> --- 
>> You received this message because you are subscribed to the Google Groups 
>> "ClojureScript" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to clojurescrip...@googlegroups.com .
>> To post to this group, send email to clojur...@googlegroups.com 
>> .
>> Visit this group at http://groups.google.com/group/clojurescript.
>>
>
>

-- 
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/d/optout.


Re: [ClojureScript] Re: [ANN] Clojure 1.7.0-beta1 released

2015-04-13 Thread David Nolen
The only reason :default exists is because *anything* in JavaScript can be
thrown and there needs to be some way to catch non-Error derived values.
This is not the case for Java of course. :default could probably be aliased
to Throwable, but in the meantime differences like this are now handleable
via conditional reading.

David

On Mon, Apr 13, 2015 at 6:37 AM, Robin Heggelund Hansen <
skinney...@gmail.com> wrote:

> Hmm... In Clojurescript you can do the following
>
> (try
>   ;; throw something
>   (catch :default e
>  e))
>
> When I try the same thing in Clojure, it seems to not be supported. Is
> there any plans to support this syntax in Clojure 1.7?
>
> --
> Note that posts from new members are moderated - please be patient with
> your first post.
> ---
> You received this message because you are subscribed to the Google Groups
> "ClojureScript" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to clojurescript+unsubscr...@googlegroups.com.
> To post to this group, send email to clojurescr...@googlegroups.com.
> Visit this group at http://groups.google.com/group/clojurescript.
>

-- 
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/d/optout.