Re: if statement not working
-------Phoenix-Boundary-07081998-
Hi Derek Parnell, you wrote on 3/22/02 7:25:57 PM:
>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.
>
>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
>
Doesn't seem too difficult, especially if the 'operator' is
set off with a special character, a situation I like anyway
because it serves to emphasize that the id is an operator:
len = a <max> b
I suppose it would be restricted to being a function, and taking
two arguments.
In addition, it would pave the way for a whole series of built-in
'operators' that say what they do.
Karl Bochert
-------Phoenix-Boundary-07081998---
|
Not Categorized, Please Help
|
|