Lines Matching refs:be

33 compatibility.  That means bad choices from the past often can't be changed
38 accomplished by compiling commands into instructions that can be efficiently
39 executed. An increase in execution speed of 10 to 100 times can be expected.
44 The performance improvements can only be achieved by not being 100% backwards
57 the highest |scriptversion|. However, this can be confusing and is therefore
60 Vim9 script and legacy Vim script can be mixed. There is no requirement to
62 `:def` functions for code that needs to be fast.
95 - Constants can be declared with `:final` and `:const`: >
97 const names = ['Betty', 'Peter'] # cannot be changed
98 - `:final` cannot be used as an abbreviation of `:finally`.
107 - A range before a command must be prefixed with a colon: >
122 The reason is that a double quote can also be the start of a string. In many
124 to tell what the meaning is, since both a string and a comment can be followed
132 To improve readability there must be a space between a command and the #
138 and produces an error where this might be confusing. #{{ or #{{{ are OK,
139 these can be used to start a fold.
160 reference (so that the argument and return types can be checked)
173 cannot be a "dict" function, and can always be a closure.
175 Later classes will be added, which replaces the "dict function" mechanism.
192 The argument types and return type need to be specified. The "any" type can
193 be used, type checking will then be done at runtime, like with legacy
215 The argument "_" (an underscore) can be used to ignore the argument. This is
221 be given.
229 variable the "g:" prefix must be used. For functions in an autoload script
249 Since a script-local function reference can be used without "s:" the name must
251 script "s:funcref" could be used, because it could not be referred to with
252 "funcref". In Vim9 script it can, therefore "s:Funcref" must be used to avoid
255 In all cases the function must be defined before used. That is when it is
256 called, when `:defcompile` causes it to be compiled, or when code that calls
259 The result is that functions and variables without a namespace can usually be
261 variables could be defined anywhere (good luck finding out where!).
263 Global functions can still be defined and deleted at nearly any time. In
265 and cannot be deleted or replaced.
297 Local variables need to be declared with `:var`. Local constants need to be
301 Variables can be local to a script, function or code block: >
319 The declaration must be done earlier: >
328 To intentionally hide a variable from code that follows, a block can be
358 In Vim9 script `:let` cannot be used. An existing variable is assigned to
360 variables, because they are not really declared. They can also be deleted
373 Global variables must be prefixed with "g:", also at the script level. >
379 Global functions must be prefixed with "g:" when defining them, but can be
389 Although global functions can be called without the "g:" prefix, they must
390 exist when compiled. By adding the "g:" prefix the function can be defined
407 not be called, even when "g:loaded_plugin" is defined later: >
410 PluginFunc() # Function may never be called
414 Since `&opt = value` is now assigning a value to option "opt", ":&" cannot be
417 For an unpack assignment the underscore can be used to ignore a list item,
418 similar to how a function argument can be ignored: >
427 That is because the type needs to be inferred from the list item type, which
434 can't be assigned another value a constant. JavaScript is an example. Others
436 cannot be changed. In Vim9 we can use both.
439 this for composite structures that you want to make sure will not be modified.
446 `:final` is used for making only the variable a constant, the value can be
466 Functions can be called without `:call`: >
471 identifier or can't be an Ex command. For a function either "(" or "->" must
472 be following, without a line break. Examples: >
495 Note that while variables need to be defined before they can be used,
496 functions can be called before being defined. This is required to allow
498 since the function has to be looked up by name. And a typo in the function
499 name will only be found when the function is called.
504 A user defined function can be used as a function reference in an expression
505 without `function()`. The argument types and return type will then be checked.
511 number of arguments and any return type (including void). The function can be
517 In legacy script there can be confusion between using "->" for a method call
542 In legacy script a lambda could be called with any number of extra arguments,
556 This can be useful for a timer, for example: >
564 The ending "}" must be at the start of a line. It can be followed by other
569 No command can follow the "{", only a comment can be used there.
571 Rationale: The "}" cannot be after a command because it would require parsing
577 To avoid the "{" of a dictionary literal to be recognized as a statement block
645 If the heredoc is inside a function 'cpoptions' must be set before :def and
661 To make it possible for the operator at the start of the line to be
683 Since a continuation line cannot be easily recognized the parsing of commands
690 there must be white space between most command names and the argument.
692 However, the argument of a command that is a command won't be recognized. For
693 example, after "windo echo expr" a line break inside "expr" will not be seen.
697 - "enddef" cannot be used at the start of a continuation line, it ends the
717 those cases the line continuation with a backslash has to be used.
726 There must be white space before and after the "=": >
728 White space must also be put before the # that starts a comment after a
762 |curly-braces-names| cannot be used.
787 In case the key needs to be an expression, square brackets can be used, just
791 The key type can be string, number, bool or float. Other types result in an
792 error. A number can be given with and without the []: >
826 the index, if items are deleted then items in the list will be skipped.
876 The boolean operators "||" and "&&" expect the values to be boolean, zero or
888 result is a boolean. "!!" can be used to turn any value into boolean: >
899 can be used.
917 In legacy script "++var" and "--var" would be silently accepted and have no
920 Numbers starting with zero are not considered to be octal, only numbers
926 Vim9 was designed to be closer to often used programming languages, but at the
928 be made. Here is a summary of what might be unexpected.
930 Ex command ranges need to be prefixed with a colon. >
943 Some Ex commands can be confused with assignments in Vim9 script: >
948 expression or assignment, a few separators cannot be used when these commands
957 Also, there cannot be a space between the command and the separator: >
994 The `exists_compiled()` function can also be used for this.
1064 The function will be compiled into instructions when
1066 used. Syntax and type errors will be produced at that
1073 script-local functions cannot be deleted or redefined
1074 later in Vim9 script. They can only be removed by
1078 :enddef End of a function defined with `:def`. It should be on
1085 variables can be accessed without the "s:" prefix. They must be defined
1087 legacy script, then script-local variables must be accessed with the "s:"
1111 Local variables will not be visible to string evaluation. For example: >
1125 For these the backtick expansion can be used. Example: >
1131 Or a script variable can be used: >
1186 These types can be used in declarations, but no simple value will actually
1193 A partial and function can be declared in more or less specific ways:
1222 The reference can also be a |Partial|, in which case it stores extra arguments
1226 Custom types can be defined with `:type`: >
1232 And classes and interfaces can be used as types: >
1255 value can be changed at any time, possibly changing the type. Therefore, in
1258 This can be a problem when the "any" type is undesired and the actual type is
1259 expected to always be the same. For example, when declaring a list: >
1270 The syntax of a type cast is: "<" {type} ">". There cannot be white space
1282 In general: Whenever the type is clear it can be omitted. For example, when
1312 In legacy Vim script, where a number was expected, a string would be
1319 before, if the value used matches the expected type. There will sometimes be
1333 If the item type was determined to be "any" it can change to a more specific
1350 A Vim9 script can be written to be imported. This means that everything in
1352 items, can then be imported in another script.
1360 To recognize a file that can be imported the `vim9script` statement must
1367 be available as `g:myvar` from any other script and function.
1370 variables in legacy Vim script, but the "s:" is omitted. And they cannot be
1373 In Vim9 script the global "g:" namespace can still be used as before. And the
1375 declared and they can be deleted.
1403 TODO: The "vim9script" feature does not exist yet, it will only be added once
1409 Exporting an item can be written as: >
1419 be exported. {not implemented yet: class, interface}
1422 `:export` can only be used in Vim9 script, at the script level.
1427 The exported items can be imported individually in another Vim9 script: >
1434 In case the name is ambiguous, another name can be specified: >
1446 `:import` can also be used in legacy Vim script. The imported items still
1449 `:import` can not be used in a function. Imported items are intended to exist
1452 The script name after `import` can be:
1457 will rarely be used.
1458 - A path not being relative or absolute. This will be found in the
1459 "import" subdirectories of 'runtimepath' entries. The name will usually be
1464 next time the same script is imported. It will not be read again.
1468 `import` won't be processed yet. Therefore cyclic imports can exist, but may
1474 For optimal startup speed, loading scripts should be postponed until they are
1481 < This goes in .../plugin/anyname.vim. "anyname.vim" can be freely chosen.
1491 must be exactly the same as the prefix for the function name, that is how
1509 namespace will be used for the imported item, even when "s:" is not specified.
1517 Most of Vim9 script can be created without this functionality, and since
1518 implementing classes is going to be a lot of work, it is left for the future.
1519 For now we'll just make sure classes can be added later.
1522 - `class` / `endclass`, the whole class must be in one file
1540 An important class that will be provided is "Promise". Since Vim is single
1572 need to be handled, such as error messages and exceptions. The need to create
1574 much overhead that cannot be avoided.
1576 Therefore the `:def` method to define a new-style function had to be added,
1588 should be done at compile time. Postponing it to runtime makes the execution
1593 dictionary throw an error. If the types are known to be numbers then an "add
1594 number" instruction can be used, which is faster. The error can be given at
1621 - Ex command ranges need to be prefixed with a colon, to avoid confusion with
1622 expressions (single quote can be a string or a mark, "/" can be divide or a
1646 will be happy with. TypeScript is a complex language with its own history,
1661 cannot assign the value to a boolean. That is inconsistent and can be
1663 result as a bool. TODO: to be reconsidered
1676 `:var`. This is used in many languages. The semantics might be slightly
1682 immutable we decided to use that. And then `:const` can be used for making
1691 Since legacy and Vim9 script will be mixed and global variables will be
1718 Since we use type inference the type can be left out when it can be inferred
1721 Also, it will not be allowed to use a variable name that could be a type name,
1732 Some details are unexpected and can be improved. For example a boolean
1735 text not starting with a number would be converted to zero, which is
1737 error and be considered false. That is confusing.
1778 - By using relative paths loading can be much faster for an import inside of a
1780 - Once an import has been used, it can be cached and loading it again can be
1782 - The Vim-specific use of "s:" to make things script-local can be dropped.
1785 globally can be used, not the exported items. Alternatives considered:
1801 The functions can't be compiled right away when encountered, because there may
1802 be forward references to functions defined later. Consider defining functions
1806 An alternative would be to first scan through the file to locate items and
1808 execute the script and compile the functions. This means the script has to be
1811 to see if it works, but it turned out to be impossible to make work nicely.
1813 It would be possible to compile all the functions at the end of the script.
1817 only reported then. In case these errors should be found early, e.g. when
1834 the tool into Vim script. For that to be possible without too much
1836 tool need to be supported. Since most languages support classes the lack of
1843 dictionary. With some care this can be made to work, but it does not look