Building on Michal's example, here is a "more minimal example" --
which also "fails" in Clojure:


(ns test
  (:require [clojure.core.async :as async]))


(defmacro silly [obj pat1 body1 other]
  `(case ~obj
     ~pat1 ~body1
     ~other))

(let []

  (def out (java.io.StringWriter.))

  (defn log [& args]
    (doseq [arg args]
      (.write out (str arg))
      (.write out "\n")))


  (async/<!! (async/go
              (silly :dog
                     :dog (log "with-go: woof woof")
                     (log "with-go: other"))))

  (str out))

On Mon, Feb 17, 2014 at 5:14 PM, t x <txrev...@gmail.com> wrote:
> Hi Michal,
>
>   Does this mean:
>
>   (a) the reported behavior is normal (and my bug report is invalid) or
>
>   (b) this error happens in both cljs + clojure ?
>
> Thanks!
>
> On Mon, Feb 17, 2014 at 4:33 PM, Michał Marczyk
> <michal.marc...@gmail.com> wrote:
>> Just to be clear, the above is a version of t x's bug-report modified
>> to use a StringWriter instead of console.log.
>>
>> Cheers,
>> Michał
>>
>>
>> On 18 February 2014 01:25, Michał Marczyk <michal.marc...@gmail.com> wrote:
>>> The same thing happens in Clojure:
>>>
>>> (defmacro silly [object pat1 body1 pat2 body2]
>>>   `(case (:tag ~object)
>>>      ~pat1 ~body1
>>>      ~body2))
>>>
>>> (def out (java.io.StringWriter.))
>>>
>>> (defn log [& args]
>>>   (doseq [arg args]
>>>     (.write out (str arg))
>>>     (.write out "\n")))
>>>
>>> (defn init []
>>>   (silly {:tag :dog}
>>>          :dog (log "without-go: woof woof")
>>>          cat (log "without-go: unrecognized"))
>>>   (async/go
>>>    (silly {:tag :dog}
>>>           :dog (log "with-go: woof woof")
>>>           cat (log "with-go: unrecognized"))))
>>>
>>> (init)
>>>
>>> (print (str out))
>>> without-go: woof woof
>>> with-go: woof woof
>>> with-go: unrecognized
>>> nil
>>>
>>> Cheers,
>>> Michał
>>>
>>>
>>> On 18 February 2014 01:01, t x <txrev...@gmail.com> wrote:
>>>> Thanks for verifying!
>>>>
>>>> @tbaldridge: can you enlighten us on if:
>>>>
>>>>   * I'm doing something stupid or
>>>>   * this is an actual bug in cljs/core.async?
>>>>
>>>> Thanks!
>>>>
>>>> On Mon, Feb 17, 2014 at 2:10 PM, Manuel Paccagnella
>>>> <manuel.paccagne...@gmail.com> wrote:
>>>>> Tested on Linux x64, Chromium 31.0.1650.63 and Firefox 26.0. Same 
>>>>> behaviour
>>>>> that you have seen. However, I haven't looked at the code yet.
>>>>>
>>>>> Il giorno lunedì 17 febbraio 2014 20:34:22 UTC+1, t x ha scritto:
>>>>>>
>>>>>> Can anyone verify whether this bug is reproducible?
>>>>>>
>>>>>> On Mon, Feb 17, 2014 at 12:28 AM, t x <txre...@gmail.com> wrote:
>>>>>> > Hi,
>>>>>> >
>>>>>> >   repo: https://github.com/txrev319/bug-report
>>>>>> >
>>>>>> >   I have a really weird bug where:
>>>>>> >
>>>>>> >   * (my-macro ...) ==> everything works
>>>>>> >
>>>>>> >   * (async/go (my-macro ...)) ==> something weird happens
>>>>>> >
>>>>>> >
>>>>>> >   A minimal failure case is documented at:
>>>>>> > https://github.com/txrev319/bug-report/blob/master/src/app.cljx
>>>>>> >
>>>>>> >   It depends on the macro defined in:
>>>>>> > https://github.com/txrev319/bug-report/blob/master/src/macros.cljx
>>>>>> >
>>>>>> >   The bug can be replicated by following the instructions at:
>>>>>> > https://github.com/txrev319/bug-report/blob/master/README.md
>>>>>> >
>>>>>> >   I *believe* I have included everything required to replicate the
>>>>>> > bug. If I am missing anything, please let me know.
>>>>>> >
>>>>>> >
>>>>>> > Extra info:
>>>>>> >
>>>>>> > $ lein --version
>>>>>> > Leiningen 2.2.0 on Java 1.7.0_45 Java HotSpot(TM) 64-Bit Server VM
>>>>>> >
>>>>>> > I'm on 64-bit OSX.
>>>>>> >
>>>>>> >
>>>>>> > 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.
>>>>
>>>> --
>>>> 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.

Reply via email to