> On 2023-06-03, Bram Moolenaar <Bram@moolenaar.net> wrote:
> >
> >> Legacy Vim script:
> >>
> >> let text = 'àbc'
> >> echo text[2]
> >>
> >> Result: 'b'
> >>
> >> Vim 9 script:
> >>
> >> const text = 'àbc'
> >> echo text[2]
> >>
> >> Result: 'c'
> >>
> >> Is the different behavior (counting chars vs bytes?) intentional?
> >
> > Yes, in Vim9 script the index is in characters. In legacy script it is
> > in bytes.
> >
> > The help for this doesn't have it's own tag, I'll add one.
> > You can find it above ":help vim9-gotchas".
>
> I was expecting to find it under `:help vim9-differences`, but either
> I missed the relevant item, or it's not there, in which case it could be
> added there.
Well, that's an overview, not a complete list. There is no objective
way to decide what to put there, what is important enough. I can add
this one, but for expressions there are more things that can matter.
Adding a link to vim9-gotchas also would be useful.
--
Execuses for making a mistake:
In the morning: "I didn't have enough coffee yet!"
In the afternoon: "Look at all the things that I did right!"
In the evening: "I'm too tired!"
/// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/20230603145544.246A01C0595%40moolenaar.net.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment