Andy Massimino wrote:
> Thanks, I did not fully appreciate the thorniness of the problem until
> you pointed it out again.
>
> On 7/16/20 5:05 PM, Bram Moolenaar wrote:
> > This leads to complications when adding line breaks.
>
> vim script has never properly supported continuation line comments,
> except for a recent patch with a different syntax inside dicts/lists, so
> I think it is totally OK to just ban double quote comments inside
> continuations.
>
> If the example of "hello"->func() is the only other case of syntax
> ambiguity, disallowing that particular kind of bare expression (with a
> warning) would be a reasonable compromise in my opinion. It is not an
> expression you encounter very frequently.
Yes, this specific example seems to be an exception. But there might be
a few more like this.
> On 7/16/20 5:05 PM, Bram Moolenaar wrote:
> > but I do tend to think that
> > the difference with legacy Vim script is good
>
> I think, I always assumed (possibly wrongly) that migrating to
> vim9script was intended to be a gradual approach. A developer would
> take an existing vim script and put vim9script at the top, and then as
> they see fit, little-by-little use the vim9 script features, like
> typing, fast def functions, and bare expressions. This is similar in
> spirit to python's typing system. Barring double-quote comments seems
> like a departure, since it is no longer true that a 'reasonable' vim
> script is a valid vim9script which is just missing a vim9script marker.
Well, if you are lucky then putting "vim9script" at the top of an
existing script will work. But there are several subtle changes in
semantics that might break it. The most obvious one is that "let" is
used for declarations, but not assignments. Most scripts will need to
be adjusted for that.
Finding and replacing double quotes at the start of the line with # is
simple enough. And as soon as you remove "call" before function calls
and "let" before assignments that are not declarations, it's already
different enough.
It's a habit to start comments with a double quote. Syntax highlighting
will soon show the mistake to help avoiding using the wrong comment
character.
> If vim9script has long ago passed the point where this is a viable
> model, or never was, then my argument isn't really valid. I suppose it
> is not extremely clear to me what the high-level goal of vim9script is.
> Especially inside the continuum of two extremes of a performant
> byte-compiled restricted form of vim script vs merely blessing an
> existing language (js,py,lua) as first-class.
We only really have one chance to define a new syntax. Once Vim9 has
launched, it has to be backwards compatible. I tend to give the long
term goals a higher priority than the short-term goal of making Vim9
script more-or-less similar to legacy Vim script.
The main long-term goals are:
- Similarity with existing programming languages, less to learn
- Consistency and preditability - no surprises
- Still similar to legacy Vim script, with Ex commands, builtin
functions, etc.
- Minimal use of punctuation, e.g. no ";" at the end of a statement.
--
The users that I support would double-click on a landmine to find out
what happens. -- A system administrator