Git Product home page Git Product logo

Comments (9)

mreuvers avatar mreuvers commented on July 25, 2024 1

Hey @jjlauer

I had other things to do past month, but at last I had the time to deal with this. I just created a pull request to resolve this enhancement.

See the request for all the details, in short it uses the normal comma and no escapes are necessary.

Could you merge it in and release the version later on?

Thanks!

from rocker.

jjlauer avatar jjlauer commented on July 25, 2024

from rocker.

mreuvers avatar mreuvers commented on July 25, 2024

Ok, that felt like the better option to me as well. Going to pick this one up then. :)

from rocker.

mreuvers avatar mreuvers commented on July 25, 2024

Hey @jjlauer,

While working on some tests for the with block, I encountered the following:

@with(String s = s.get(0)) {
  @s
}
else {
  // it will never get here, but the else is allowed here
}

The above is currently allowed already, though the else will never be executed since this is not a null-safe block (it is a bit like dead code).
This may be a bug, and it may be nice to actually have it fail, so users do get an error about it.

I can fix this alongside this enhancement if you want, to allow the else only for a null-safe with block. I intend to forbid it already for the multiple arguments one anyway.

What has your preference?

from rocker.

jjlauer avatar jjlauer commented on July 25, 2024

from rocker.

mreuvers avatar mreuvers commented on July 25, 2024

Hey @jjlauer,

All right.

How do we want to escape the comma, as it can easily be used in the expressions e.g.

@with (List<String> subs = strings.sublist(1\,2), List<String> anotherSub=strings.subList(0\,1).subList(0\,1), String t = "hello\, world") {
}

In the above example I escaped the relevant ones with a single back slash, I guess that would be my preference. What do you think?

from rocker.

jjlauer avatar jjlauer commented on July 25, 2024

from rocker.

mreuvers avatar mreuvers commented on July 25, 2024

Semicolon would not really work either, since it can be used inside a String (see above).

I'll think about it for now on how to deal with it. If I get the comma working I prefer that over something else. If not then we can do something else.

from rocker.

mreuvers avatar mreuvers commented on July 25, 2024

Thanks for applying the pull request and releasing @jjlauer!

I will close this issue then. :)

from rocker.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.