comparison runtime/doc/eval.txt @ 8512:5104f96b6ecf v7.4.1546

commit https://github.com/vim/vim/commit/f6f32c38bf3319144a84a01a154c8c91939e7acf Author: Bram Moolenaar <Bram@vim.org> Date: Sat Mar 12 19:03:59 2016 +0100 patch 7.4.1546 Problem: Sticky type checking is more annoying than useful. Solution: Remove the error for changing a variable type.
author Christian Brabandt <cb@256bit.org>
date Sat, 12 Mar 2016 19:15:04 +0100
parents ee5cb2e9ed5a
children 485d4d8a97f6
comparison
equal deleted inserted replaced
8511:2712bfe5d62e 8512:5104f96b6ecf
1 *eval.txt* For Vim version 7.4. Last change: 2016 Mar 08 1 *eval.txt* For Vim version 7.4. Last change: 2016 Mar 12
2 2
3 3
4 VIM REFERENCE MANUAL by Bram Moolenaar 4 VIM REFERENCE MANUAL by Bram Moolenaar
5 5
6 6
111 to Float, printf() for Float to String and float2nr() for Float to Number. 111 to Float, printf() for Float to String and float2nr() for Float to Number.
112 112
113 *E891* *E892* *E893* *E894* *E907* *E911* *E914* 113 *E891* *E892* *E893* *E894* *E907* *E911* *E914*
114 When expecting a Float a Number can also be used, but nothing else. 114 When expecting a Float a Number can also be used, but nothing else.
115 115
116 *E706* *sticky-type-checking* 116 *no-type-checking*
117 You will get an error if you try to change the type of a variable. You need 117 You will not get an error if you try to change the type of a variable.
118 to |:unlet| it first to avoid this error. String and Number are considered
119 equivalent though, as well are Float and Number. Consider this sequence of
120 commands: >
121 :let l = "string"
122 :let l = 44 " changes type from String to Number
123 :let l = [1, 2, 3] " error! l is still a Number
124 :let l = 4.4 " changes type from Number to Float
125 :let l = "string" " error!
126 118
127 119
128 1.2 Function references ~ 120 1.2 Function references ~
129 *Funcref* *E695* *E718* 121 *Funcref* *E695* *E718*
130 A Funcref variable is obtained with the |function()| function. It can be used 122 A Funcref variable is obtained with the |function()| function. It can be used
1967 isdirectory( {directory}) Number TRUE if {directory} is a directory 1959 isdirectory( {directory}) Number TRUE if {directory} is a directory
1968 islocked( {expr}) Number TRUE if {expr} is locked 1960 islocked( {expr}) Number TRUE if {expr} is locked
1969 isnan( {expr}) Number TRUE if {expr} is NaN 1961 isnan( {expr}) Number TRUE if {expr} is NaN
1970 items( {dict}) List key-value pairs in {dict} 1962 items( {dict}) List key-value pairs in {dict}
1971 job_getchannel( {job}) Channel get the channel handle for {job} 1963 job_getchannel( {job}) Channel get the channel handle for {job}
1964 job_info( {job}) Dict get information about {job}
1972 job_setoptions( {job}, {options}) none set options for {job} 1965 job_setoptions( {job}, {options}) none set options for {job}
1973 job_start( {command} [, {options}]) Job start a job 1966 job_start( {command} [, {options}]) Job start a job
1974 job_status( {job}) String get the status of {job} 1967 job_status( {job}) String get the status of {job}
1975 job_stop( {job} [, {how}]) Number stop {job} 1968 job_stop( {job} [, {how}]) Number stop {job}
1976 join( {list} [, {sep}]) String join {list} items into one String 1969 join( {list} [, {sep}]) String join {list} items into one String
4471 To check if the job has no channel: > 4464 To check if the job has no channel: >
4472 if string(job_getchannel()) == 'channel fail' 4465 if string(job_getchannel()) == 'channel fail'
4473 < 4466 <
4474 {only available when compiled with the |+job| feature} 4467 {only available when compiled with the |+job| feature}
4475 4468
4469 job_info({job}) *job_info()*
4470 Returns a Dictionary with information about {job}:
4471 "status" what |job_status()| returns
4472 "channel" what |job_getchannel()| returns
4473 "exitval" only valid when "status" is "dead"
4474 "exit-cb" function to be called on exit
4475 "stoponexit" |job-stoponexit|
4476
4476 job_setoptions({job}, {options}) *job_setoptions()* 4477 job_setoptions({job}, {options}) *job_setoptions()*
4477 Change options for {job}. Supported are: 4478 Change options for {job}. Supported are:
4478 "stoponexit" |job-stoponexit| 4479 "stoponexit" |job-stoponexit|
4479 "exit-cb" |job-exit-cb| 4480 "exit-cb" |job-exit-cb|
4480 4481
4481 job_start({command} [, {options}]) *job_start()* 4482 job_start({command} [, {options}]) *job_start()*
4482 Start a job and return a Job object. Unlike |system()| and 4483 Start a job and return a Job object. Unlike |system()| and
4483 |:!cmd| this does not wait for the job to finish. 4484 |:!cmd| this does not wait for the job to finish.
4484 4485