Phix:optional/named Parameter inside a class unexpected behavior?
- Posted by andreasWagner in December
- 568 views
Hallo
from my Point of view there is an unexpected behavior using named Parameter inside a class.
To make this clear i wrote some example-code:
--optional/named Parameter --Phix 1.0.4 64bit Win10 function adc(integer x,integer y) return x+y end function ?adc -- unexpected result no crash/why? --?adc() -- crash with missing parameters expected ?adc(2,2) -- works --?adc(x:=2) -- crash expected function add(integer x=1,integer y=1) return x+y end function ?add -- unexpected result no crash/why? ?add() -- works ?add(2,2) -- works ?add(x:=2) -- works class two function add(integer x=1,integer y=1) return x+y end function end class two addfunc=new() ?addfunc.add --unexpected result no crash/why? ?addfunc.add() --works ?addfunc.add(2,2) --works --?addfunc.add(x:=2) --crash with undefined identifier x unexpected wait_key()
Thank you