Re: RFC 161 (v2) OO Integration/Migration Path
[email protected] ("Matt Youell")
| Newsgroups | perl.perl6.language.objects |
|---|---|
| Organization | Silicon Spike |
| Message-ID | <[email protected]> |
> Arg! You beat me to it. :-) This was the next RFC on my list. Nate, if I had known that, I would gladly have let you take the arrows. =^) > However, nobody should ever have to call something like $n->NUMBER or > $n->asInt if they don't want to. And they definitely shouldn't have to > know they exist. You should still be able to write a large Perl script > without having to even know Perl supports OO at all. I agree completely. To clarify: Methods such as 'asInt()' could be ignored at will. If they were never called, Perl would still Do The Right Thing. So, totally optional, and (more importantly) invisible. As I think about this, however, I can imagine that some might want to force it's use. Perhaps that requirement could be built into a strict pragma, like 'use StrictTypes' ?? I seem to recall an RFC along those lines. > print $FILEHANDLE @data; > > This would try $FILEHANDLE->print, or CORE::print if it doesn't exist. Same for seek, read, etc. Also, Scalars could also have a 'toString()' method (or similar), borrowing from Java. > commit $firstname # or rollback $firstname > > Take your pick. Surprisingly, I hadn't considered continuing on with the indirect syntax like that, but it makes total sense. Very cool. Thanks! Matt