Re: Re: This is kind of cool
Paul Prescod <[email protected]>
| Newsgroups | gmane.comp.lang.prothon.user |
|---|---|
| Message-ID | <[email protected]> |
Mark Hahn wrote: > Paul Prescod wrote: > > >>def foo(): >> return 3 >> >>def foo.add_(other): >> return 2 + other >> >>print foo + foo() > > > Should I be proud or embarrased that the language I designed supports a > feature I don't understand :-) > > I see what it is doing, but I don't see why one would want this. I've never wanted it myself but...Sam is a big fan of operators and functional programming. His talk reminded me of a vague idea I had had for user-defined operators. I was thinking of something like: abc ~+~ def abc ~add~ def The basic idea is that you can define binary infix operators that start and end with tildes. The tilde-bracketing makes it easy to parse. The stuff between the tildes can be almost anything other than whitespace. I suppose operator precedence is where it starts to get a little complicated. It isn't my highest priority so I'm not going to spend cycles trying to figure it out...and I'm not sure whether you are interested in such a feature. Sam's talk at the Vanpyz conference is supposed to be on a "little language" he designed using generators and Python operator overloading for Icon-style stream pattern matching. Paul Prescod