comparison runtime/doc/eval.txt @ 16219:bd49e1656c72 v8.1.1114

patch 8.1.1114: confusing overloaded operator "." for string concatenation commit https://github.com/vim/vim/commit/0f248b006c2574abc00c9aa7886d8f33620eb822 Author: Bram Moolenaar <Bram@vim.org> Date: Thu Apr 4 15:36:05 2019 +0200 patch 8.1.1114: confusing overloaded operator "." for string concatenation Problem: Confusing overloaded operator "." for string concatenation. Solution: Add ".." for string concatenation. Also "let a ..= b".
author Bram Moolenaar <Bram@vim.org>
date Thu, 04 Apr 2019 15:45:04 +0200
parents 2c33b119ba92
children abb67309c1ca
comparison
equal deleted inserted replaced
16218:0874f5cbaaa6 16219:bd49e1656c72
784 784
785 |expr1| expr2 785 |expr1| expr2
786 expr2 ? expr1 : expr1 if-then-else 786 expr2 ? expr1 : expr1 if-then-else
787 787
788 |expr2| expr3 788 |expr2| expr3
789 expr3 || expr3 .. logical OR 789 expr3 || expr3 ... logical OR
790 790
791 |expr3| expr4 791 |expr3| expr4
792 expr4 && expr4 .. logical AND 792 expr4 && expr4 ... logical AND
793 793
794 |expr4| expr5 794 |expr4| expr5
795 expr5 == expr5 equal 795 expr5 == expr5 equal
796 expr5 != expr5 not equal 796 expr5 != expr5 not equal
797 expr5 > expr5 greater than 797 expr5 > expr5 greater than
809 expr5 is expr5 same |List|, |Dictionary| or |Blob| instance 809 expr5 is expr5 same |List|, |Dictionary| or |Blob| instance
810 expr5 isnot expr5 different |List|, |Dictionary| or |Blob| 810 expr5 isnot expr5 different |List|, |Dictionary| or |Blob|
811 instance 811 instance
812 812
813 |expr5| expr6 813 |expr5| expr6
814 expr6 + expr6 .. number addition, list or blob concatenation 814 expr6 + expr6 ... number addition, list or blob concatenation
815 expr6 - expr6 .. number subtraction 815 expr6 - expr6 ... number subtraction
816 expr6 . expr6 .. string concatenation 816 expr6 . expr6 ... string concatenation
817 expr6 .. expr6 ... string concatenation
817 818
818 |expr6| expr7 819 |expr6| expr7
819 expr7 * expr7 .. number multiplication 820 expr7 * expr7 ... number multiplication
820 expr7 / expr7 .. number division 821 expr7 / expr7 ... number division
821 expr7 % expr7 .. number modulo 822 expr7 % expr7 ... number modulo
822 823
823 |expr7| expr8 824 |expr7| expr8
824 ! expr7 logical NOT 825 ! expr7 logical NOT
825 - expr7 unary minus 826 - expr7 unary minus
826 + expr7 unary plus 827 + expr7 unary plus
845 function(expr1, ...) function call 846 function(expr1, ...) function call
846 func{ti}on(expr1, ...) function call with curly braces 847 func{ti}on(expr1, ...) function call with curly braces
847 {args -> expr1} lambda expression 848 {args -> expr1} lambda expression
848 849
849 850
850 ".." indicates that the operations in this level can be concatenated. 851 "..." indicates that the operations in this level can be concatenated.
851 Example: > 852 Example: >
852 &nu || &list && &shell == "csh" 853 &nu || &list && &shell == "csh"
853 854
854 All expressions within one level are parsed from left to right. 855 All expressions within one level are parsed from left to right.
855 856
1024 "foo\nbar" =~ "\\n" evaluates to 0 1025 "foo\nbar" =~ "\\n" evaluates to 0
1025 1026
1026 1027
1027 expr5 and expr6 *expr5* *expr6* 1028 expr5 and expr6 *expr5* *expr6*
1028 --------------- 1029 ---------------
1029 expr6 + expr6 Number addition, |List| or |Blob| concatenation *expr-+* 1030 expr6 + expr6 Number addition, |List| or |Blob| concatenation *expr-+*
1030 expr6 - expr6 Number subtraction *expr--* 1031 expr6 - expr6 Number subtraction *expr--*
1031 expr6 . expr6 String concatenation *expr-.* 1032 expr6 . expr6 String concatenation *expr-.*
1033 expr6 .. expr6 String concatenation *expr-..*
1032 1034
1033 For |Lists| only "+" is possible and then both expr6 must be a list. The 1035 For |Lists| only "+" is possible and then both expr6 must be a list. The
1034 result is a new list with the two lists Concatenated. 1036 result is a new list with the two lists Concatenated.
1037
1038 For String concatenation ".." is preferred, since "." is ambiguous, it is also
1039 used for |Dict| member access and floating point numbers.
1035 1040
1036 expr7 * expr7 Number multiplication *expr-star* 1041 expr7 * expr7 Number multiplication *expr-star*
1037 expr7 / expr7 Number division *expr-/* 1042 expr7 / expr7 Number division *expr-/*
1038 expr7 % expr7 Number modulo *expr-%* 1043 expr7 % expr7 Number modulo *expr-%*
1039 1044
5798 message. Use |exists()| to check for existence. 5803 message. Use |exists()| to check for existence.
5799 5804
5800 isnan({expr}) *isnan()* 5805 isnan({expr}) *isnan()*
5801 Return |TRUE| if {expr} is a float with value NaN. > 5806 Return |TRUE| if {expr} is a float with value NaN. >
5802 echo isnan(0.0 / 0.0) 5807 echo isnan(0.0 / 0.0)
5803 < 1 ~ 5808 < 1
5804 5809
5805 {only available when compiled with the |+float| feature} 5810 {only available when compiled with the |+float| feature}
5806 5811
5807 items({dict}) *items()* 5812 items({dict}) *items()*
5808 Return a |List| with all the key-value pairs of {dict}. Each 5813 Return a |List| with all the key-value pairs of {dict}. Each