Re: Into and such

2018-04-08 Thread Marcus Comstedt (ACROSS) (Hail Ilpalazzo!) @ Pike (-) developers forum
>> (typeof(x) & _typeof(y)) == _typeof(y); >(8) Result: 1 A simpler (better?) way to test "can x hold the value y" is typeof(x) >= _typeof(y)

Re: Into and such

2018-04-08 Thread H. William Welliver III
The [type]p() functions all test the value in a variable, as does _typeof(), which returns a type value: > int|float x = 0.0; > intp(x); (1) Result: 0 > int|float x = 0; > intp(x); (2) Result: 1 > _typeof(x); (3) Result: zero > x = 1.0; (4) Result: 1.0 > _typeof(x); (5) Result: float

Into and such

2018-04-08 Thread Marcus Comstedt (ACROSS) (Hail Ilpalazzo!) @ Pike (-) developers forum
intp() etc work on values. In this way they work the same as _typeof(). So the result of intp(x) will be the same as that of intp(5.0), which is to say 0. To get the type of the variable, use typeof().

Re: Into and such

2018-04-08 Thread Lance Dillon
Although thinking, probably only happens in languages where type can change arbitrarily.  Here the type can't change except in a new block, which isn't really changing the type, but creating a new variable with the same name that shadows the old variable. Sent from Yahoo Mail on Android On

Into and such

2018-04-08 Thread Lance Dillon
Just out of curiosity, how does intp() and such work. Say you have int|float x, then x=5.0.   Does intp test the type of the variable, or the type of the contents.  Does intp(x) return true because x is of type int (also of type float), or false because the contents of x (currently 5.0) is float,