Open Kampfkarren opened 7 years ago
It should be implicit, with vaguely defined rules. If, say, you have a function like this:
int Twice(int x)
{
return x * 2
}
And you pass it something that's not an int
, say... a boolean
:
$Result = Twice(True);
Console.StandardOutputStream >> disp($Result) >> Console.Characters.EndLine;
Then it should convert from boolean
to int
in an odd, unclearly defined way. In this case, I'd guess the output would be:
2
But it could also be:
0
Or:
example.pyph_pph:1:16: error: Cannot convert boolean to int.
We can take the C/C++ approach with either
(type)value
ortype(value)
or the PHP-esque route of adding functions to the global namespace, such asto_boolean(value)
,to_int(value)
, etc.