Re: Re: Simple (?) fix for _call and _str

Paul Prescod <[email protected]>
Newsgroups gmane.comp.lang.prothon.user
Message-ID <[email protected]>
Mark Hahn wrote:

>...
> I'd like to keep the basic operations like the object keyword 
 > untouched.  We don't want to force 2-tier down their
 > throats.  Using newProto() would work.

First: I feel like two-tier will be most people's default mode. It is 
simply the nature of programming that at the time you are coding you do 
not have access to the runtime information that makes objects useful. So 
objects have blanks that are filled in with init_ and that's when they 
become useful.

Second: I'm not sure what you mean by "newProto()" would work? What 
precise syntax would I use to make a new prototype?

object foo:
   ...

foo = newProto(foo)

Or something like that???

>...
> You could just use the presence of "typeName_" to indicate that an object is
> a prototype and kill two birds with one stone.  I'd call it "protoName_"
> myself.

typeName_ is inherited. The key to the idea is that there has to be one 
property that is not inherited. typeName_ *should* be inherited because 
when I introspect an integer I want to be able to see that it is an integer.

> I like your two-name idea for instStr_ and protoStr_.  I would want to use
> str_ and protoStr_ for the same reason that I didn't want to change the
> object keyword.  I would want the object keyword, call_ and str_ to work as
> before in the default case.

Actually, in my proposal, call_ and str_ do work as before but in the 
docs I would discourage people from overriding them. "Usually you will 
want to override instStr_ or protoStr_. If you wish to override both at 
once you can just override str_."

> Negatives compared to Serge's and my proposals...
> 
> 1) Lack of dual namespaces.  (You are the one that got us started on them
> <grin>).

True. But it is also in the dual namespaces that everything started 
getting complicated. You can't really have simple directed method 
calling AND separate namespaces at the same time.

>...
> I will vote for this.  How does everyone else feel?   Comments?  Votes?

I won't vote for my own proposal until I understand better what it looks 
like after your amendments. ;)

  Paul Prescod
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.