U mean something like 'term' (or how this thing is called 'bareword' ? )
So I can say :
# $x = 10k;
my sub operator:number is postfix(k) ($num) {
return $num * 1000
}
# $x = 10K;
my sub operator:number is postfix(K) ($num) {
return $num * 1024
}
#u can say later print $x if $x?; :")
my sub operator:var is postfix:(?) ($var) {
$num > 10 ?? 1 :: 0;
}
my sub operator:sub is prefix:(U) (....) {
uc @params
}
very oversimplified of course... It become funny :") isn't it...
=====
iVAN
[EMAIL PROTECTED]
=====
| On Wed, Oct 10, 2001 at 05:21:02PM +0200, raptor wrote:
| > | So the imaginary numbers would be standard literals? Like
| > |
| > | $x=2+10i;
| > |
| > | Great idea, as well as sqrt(-1) returning 1i istead of raising the
| > | exception. BTW, I was thinking once that numeral literals like 4k or
10G
| > | (meaning 4*2**10, 10*2**30) would be very nice. What do you think?
| >
| > I like the idea ... this is one of the ways to suspend the calculations
to
| > the last moment...
| > But one probelm comes to my mind, what the k,G etc mean
| > 1000 or 1024
| > or k => 1000, K => 1024
| >
| > Or probably the best way will be to have a hook so that we can specify
what
| > is a Number and how it has to be calculated down to the real
number...!!!
|
| How about we let users define their own postfix operators such that
| they can make 10K, 10M, 10G mean whatever they want. Perhaps this is
| also where the postfix "?" and "!" from Ruby can come in.
|
| I'd still advocate supporting imaginary numbers in core somehow
| though. With a pragma would be best I think so that exceptions are
| thrown on sqrt(-1) unless they really want imaginaries.