Re: if statement not working
- Posted by Derek Parnell <ddparnell at bigpond.com> Mar 22, 2002
- 543 views
----- Original Message ----- From: <kbochert at ix.netcom.com> To: "EUforum" <EUforum at topica.com> Subject: Re: if statement not working >I think > > if begins_with (s, "*AUTHOR ") then > >is self-explanatory. Maybe, but is this asking if s begins with "*AUTHOR ", or "*AUTHOR " begins with s ? It is not so unambiguous really. >Or how about another oddball operator (infix function??) > > if s <begins_with> "*AUTHOR " then I like the idea of infix functions. I notice in the D news-group this is sometimes discussed. It must be a real pain for interpreter/compiler writers to do well though. PreFix functions are where the function name appears to the left of its parameters, infix functions have parameters before and after the function name, and postfix functions have their parameters on the lefthand side. Prefix: add a b Infix: a add b postfix: a b add Most languages support prefix functions, some post fix (eg Forth) , but rarely infix. Infix is usually only reserved for operators such as + and *. So how about something like : infix function begins_with( object x : object y ) return (match(y,x) = 1) end function if a begins_with b then . . . end if Just a thought ----------- Derek