vscode

Quiet in here? Check #calva-dev out :smiley:
kwladyka 2019-10-09T09:48:02.000100Z

Hi @pez, I see there is bad highlight syntax when use #_#_. (get-in ...) should be also commented

kwladyka 2019-10-09T09:48:24.000800Z

hmm I guess you prefer to make it on github instead of here

pez 2019-10-09T10:15:59.001500Z

So, what is that, an ignored ignored form?

2019-10-09T11:28:20.001900Z

TIL

cljs.user=> (let [#_id (+ 1 2)]
       #_=>   )
Unexpected error (ExceptionInfo) macroexpanding cljs.core$macros/let at (<cljs repl>:1:1).
let requires an even number of forms in binding vector
cljs.user=> (let [#_#_id (+ 1 2)])
nil

🤘 2
2019-10-09T11:31:05.002200Z

cljs.user=> (+ 1 #_#_1 1 1)
2
cljs.user=> (+ 1 #_#_1 1 )
1

🤘 1
pez 2019-10-09T11:40:13.003200Z

Yeah, so the error in the highlighting is that composite-id is dimmed, right?

2019-10-09T11:43:22.003700Z

I believe #_ comments out one form

2019-10-09T11:43:34.004200Z

so ## should dimm out two forms

pez 2019-10-09T11:43:34.004300Z

exactly

2019-10-09T11:43:47.004600Z

#_#_

2019-10-09T11:44:13.005100Z

cljs.user=> (+ 1 #_#_1 1 1)
2
Like here it commented out two 1's

2019-10-09T11:45:25.006Z

(+ 1 #_#_1 1 1) === (+ 1 #_1 #_1 1)
if this makes more sense

pez 2019-10-09T11:50:36.006500Z

Hmmm, wow.

pez 2019-10-09T11:54:22.007100Z

OK so:

[#_#_id (+ 1 2)] === []
Right?

2019-10-09T11:54:32.007400Z

yes

pez 2019-10-09T11:54:45.007700Z

Cool. Thanks. I'll see what I can do about it.

2019-10-09T11:54:54.007900Z

cljs.user=> (= [#_#_id (+ 1 2)] [])
true

2019-10-09T11:54:57.008100Z

🙂

👍 1
pez 2019-10-09T11:58:21.008900Z

Why is it like that? My brain hurts a bit.

pez 2019-10-09T12:00:14.009300Z

user=> (= [#_#_#_#_ 1 2 3 4] [])
true

2019-10-09T12:00:35.009600Z

you know how you acn do stuff like

2019-10-09T12:00:44.010Z

#_ (foo)

2019-10-09T12:00:51.010300Z

and it will still comment out (foo)

pez 2019-10-09T12:00:59.010600Z

Yeah

2019-10-09T12:01:50.011500Z

so now think of it in a way that in ##1 2 first discard macro will discard the 1 and the second one will have nothing in front of it but 2, so it will discard 2

2019-10-09T12:02:16.011900Z

so I think the #_ looks in front of it till it finds something and comments it out

2019-10-09T12:02:23.012100Z

and something that is not there

2019-10-09T12:02:37.012500Z

cannot be discarded twice?

2019-10-09T12:02:41.012700Z

now my brain hurts

2019-10-09T12:02:42.012900Z

😄

pez 2019-10-09T12:12:04.014100Z

It seems like it is read like so (conceptually):

#_(#_ 1) 2

pez 2019-10-09T12:12:53.015Z

And then... ouch....

#_(#_(#_(#_ 1) 2) 3) 4

pez 2019-10-09T12:15:14.015900Z

I think it will prove a bit difficult to make my parser handle this...

kwladyka 2019-10-09T18:30:56.018100Z

(let [#_#_product (fetch-product 1
                               extra line of parameters
                               true false :promotion)
       product (fetch-product-v2 1)]
...)
^ general use case is to comment out something during testing also with cond-> etc.

kwladyka 2019-10-09T18:31:43.018400Z

I think this above cover 95% of use cases?

kwladyka 2019-10-09T18:33:49.019200Z

so the point of using #_#_ is to easy deal with comment multi lines

kwladyka 2019-10-09T18:34:26.019600Z

see also adding ; would comment let [

pez 2019-10-09T18:44:14.020100Z

Got it. I’m trying to see if I can fix it.

pez 2019-10-09T22:13:12.020200Z

Getting there. We’ll see if I make it the whole way. 😃

👍 1
pez 2019-10-09T22:46:02.020600Z

https://github.com/BetterThanTomorrow/calva/issues/385

👍 2