Git Product home page Git Product logo

upgrade-scripts-for-0.17's People

Contributors

xiaq avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

upgrade-scripts-for-0.17's Issues

Vars qualified with a `local:` namespace prefix aren't handled correctly

Long ago, when I first started using Elvish, I wrote a nx function. Its purpose is to run an external command and ignore specific non-zero exit status exceptions. The function employs the local: namespace prefix. This statement:

local:exc = $ok

Was mutated to this:

var local:exc = $ok

Which results in this error when starting a new Elvish shell:

Exception: compilation error: variable declared in var must be unqualified
/Users/krader/.config/elvish/lib/util.elv, line 104:     var local:exc = $ok
/Users/krader/.config/elvish/rc.elv, line 37: use util

Errors would be improved by replacing `[stdin]` with the file name if it is known

I ran upgrade-scripts-for-0.17 -w **.elv in my ~/.config/elvish directory. It reported a bunch of errors like this one:

Multiple parse errors:
  should be variable name
    [stdin], line 174:
      	&su= $&segment_su

It wasn't hard to find the offending script but it would be nice if the error message reported the pathname rather than [stdin]. In this case the error(s) were due to lib/github.com/muesli/elvish-libs/theme/muesli.elv that I installed long, long, ago but never used after trying it once. It might also be better to simply stop after the first parse error since a parse error means that any further effort to convert the script is unlikely to yield useful results and likely to result in a lot of additional parse errors.

Not a serious issue: running the conversion tool twice

This is just a FYI. I do not actually expect any changes to accommodate this scenario. I accidentally ran this tool twice in a row using the latest version of the tool as I write this:

upgrade-scripts-for-0.17 -lambda -w **[type:regular].elv

That resulted in a sequence of errors like this:

Multiple parse errors:
  should be '}'
    lib/interactive.elv, line 31:
      fn hr {||]
  unexpected rune ']'
    lib/interactive.elv, line 31:
      fn hr {||]

Which is not at all surprising yet still surprised me. It made we ponder whether it is possible to do better by only converting a file once? The obvious approach is to add a prefix, such as "# elvish 0.17.0\n", to the transformed output. The presence of that prefix causes the conversion tool to ignore the file. That, however, is a fragile mechanism with ambiguities. I don't expect this to be resolved but wanted to document the problem in case there was an obvious (other than to me) solution.

Wrong output given an empty argument list

Minmal example:

⬥ echo 'x = []{ nop }' | upgrade-scripts-for-0.17 -lambda
var x = {||] nop }

I have no idea why one of my scripts used this construct, but it did. It's an odd corner case that nevertheless should be fixed.

Edited to add: No problem with [ ]{ nop }. A single space makes all the difference.

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.