Nim icon indicating copy to clipboard operation
Nim copied to clipboard

Support dot-like method calls; alternative to #19384 #19919; fixes #19392

Open ringabout opened this issue 2 years ago • 8 comments

closes #19384 closes #19919 fixes #19392

tests are coming ...

ringabout avatar Jun 22 '22 13:06 ringabout

I'm checking https://github.com/nim-lang/Nim/issues/19806

ringabout avatar Jun 22 '22 13:06 ringabout

Hi @markspanbroek. I tested the tests of question, all of them pass. I would like to add questionable to important packages in case of regression. However it is blocked by https://github.com/mratsim/weave/pull/182

ringabout avatar Jun 24 '22 14:06 ringabout

for i in x .++ (if true: 12):
  collector.add i

if expr gives the same error like before:

Error: expression '12' is of type 'int literal(12)' and has to be used (or discarded)

ringabout avatar Jun 24 '22 14:06 ringabout

Please explain your solution here.

Araq avatar Jun 28 '22 04:06 Araq

Sorry for the delay. My PR has the same problem as https://github.com/nim-lang/Nim/issues/8759 ([parser] a => counter+=1 parsed as (a => counter) += 1, violating the spec, and causing issues with => )

ringabout avatar Jul 04 '22 09:07 ringabout

What's the status on this PR :) ? Looking forward for questionable to work again on devel

Menduist avatar Aug 03 '22 12:08 Menduist

@Menduist, Sorry for the inconveneience. I cannot think of a good solution.

https://github.com/nim-lang/Nim/pull/19919 can be merged now which reverts enabling the experiemental feature, we can embrace dot-like method calls in the future.

ringabout avatar Aug 03 '22 12:08 ringabout

Maybe it's the best solution indeed, we can keep it as an optional flag until we find a solution / give up & remove it

Menduist avatar Aug 03 '22 14:08 Menduist

I will revisit it later.

ringabout avatar Sep 22 '22 13:09 ringabout