Re: Re: proposal for call_ and str_
"Mark Hahn" <[email protected]>
| Newsgroups | gmane.comp.lang.prothon.user |
|---|---|
| Message-ID | <[email protected]> |
Paul Prescod wrote:
> What does the syntax look like if I want to use the default str_ and
> call_?
>
> object Proto:
> def str_():
> return "foo"
>
> def call_():
> return "bar"
>
> factory:
> pass
>
> Will this generate me an attrProxy.str_ and attrProxy.call_?
I'm having second thoughts on this (in other words I was wrong). Even
though factory isn't specific to classes and isn't supposed to give class
behavior, we could come up with something generic for prototypes.
The default attrProxy_.call_() could just make a prototype extension object
and attrProxy_.str_() could just print <Prototype:9ac3e>.
I would place the factory keyword so it looks more like a decorator:
object Proto:
factory: pass
def str_():
return "foo"