[Gambas-user] Suggestions 4 new keywords

Dag Jarle Johansen dag.jarle.johansen at ...2312...
Fri Sep 17 01:16:43 CEST 2010


Hi to all,

Am Freitag, den 17.09.2010, 00:06 +0200 schrieb Benoît Minisini:

> > 2010/9/16 Benoît Minisini <gambas at ...1...>:
> > > (1) First, you must realize that the syntax is not the implementation. In
> > > a more general way, the word is not the thing. We are confused by that
> > > all the life. :-)
> > 
> > What are you talking about?
> 
> That, for me, the implementation, i.e. the internals of the interpreter, is 
> the most important. The syntax is less important.
> 
> > 
> > > So, replacing one word (for example PUBLIC) by another (ATTRIBUTE),
> > > whereas the implementation is the same behind is not a good idea,
> > > because then this is not BASIC anymore.
> > 
> > I'm never said that PUBLIC would be replaced by ATTRIBUTE. That have no
> > sense.
> 
> I mean that declaring a public variable with PUBLIC or with ATTRIBUTE is 
> always declaring a public variable, with another keyword.
> 


I can only agree here - that are just words, and really, there are so
many programm-languages on this world - one just has to be used to what
is needed. To explode Gambas to a standard OOP-language is a little too
much, at this time at least


> > 
> > Neither, I never said that my proposed syntax should be replace the
> > current.
> > 
> > > I don't mean that the current syntax better,
> > 
> > The current syntax is fine, but an alternative syntax could be better
> > for some programmers
> > 
> > > but that as I chose to implement
> > > a BASIC, I have to follow something that looks like the common usages in
> > > other languages..
> > 
> > That is not an impediment to an alternative syntax. In fact, Gambas
> > have alternative syntax for many things:
> > 
> > - Loops
> > - String functions (VB component)
> > 
> 
> The two cases are just exceptions: the first one, because of the common syntax 
> of BASIC languages, and the second because of VB, and they are methods of a 
> class, not keywords.
> 
> Otherwise, I try to limit the number of keywords as much as possible.
> 
> > > (2) I find your VALIDATE / UNSUCCESSFUL... useless, as you introduce a
> > > lot of syntactic sugar for something that is actually not so frequent.
> > 
> > VALIDATE / UNSUCCESSFUL (they could be other words) allow that
> > programmer don't have to write getters and setters or properties
> > unnecessarily. For example, if you define un attribute as part of
> > class interface is obvious that you want allow its value can be
> > readed; so, why you have to write a getter?
> > 
> > Similarly, that attribute must be set. So, why write a setter or
> > _Write method attached to a property?
> > 
> > Ok, you just can define it as PUBLIC and, at least in principle, the
> > encapsulation would be assured; but, further changes could be more
> > difficult to do: programmer should change PUBLIC by PRIVATE on this
> > attribute, define getters and setters or (worse) a property and _READ,
> > _WRITE methods.
> > 
> > Instead, using INTERFACE/IMPLEMENTATION and VALIDATE only would be
> > necessary to add a validation.
> 
> It is what I meant: a special syntax to define something not so frequent. You 
> take the case where your "property" is actually just a bit more than a 
> variable. This is actually rarely the case. Reading is often just returning 
> the contents of a variable, but writing is usually more complex. I don't know 
> how to cover all possible cases with less keywords than the current syntax.
> 
> > 
> > > (3) On the other hand, it might be a good idea to allow the user to
> > > separate the public and the private thing.
> > > 
> > > Note that I am not agree with the common separation between "interface"
> > > and "implementation". In the real life, they are not separated. A good
> > > interface usually leads directly to the implementation. Or the interface
> > > surface from a good implementation. :-)
> > 
> > I don't understand you. In the real life there are many examples as
> > one and the other: your clothing is an interface and is not part of
> > you, but your skin is an interface too that is part of you.
> 
> When I mean "real life", I mean "real programming life". :-)
> 
> > 
> > Anyway, actually in Gambas the declaration of interface and
> > implementation are separated by PUBLIC, PRIVATE and PROPERTY keywords.
> > 
> > > Doriano's idea may be good: when PUBLIC or PRIVATE is alone on his line,
> > > everything after is declared PUBLIC (or PRIVATE) by default. That way,
> > > you can
> > 
> > > write:
> > Oh! That is my idea and I'm going to patent it. :-P
> > 
> > (read below of "or much better")
> > 
> > http://old.nabble.com/Ideas4Gambas-to28782834.html
> 
> Sorry, I didn't know you were the father. :-)
> 
> Regards,
> 


Outiting:
"I mean that declaring a public variable with PUBLIC or with ATTRIBUTE
is 

always declaring a public variable, with another keyword."


I can only agree here - that are just words, interpreted by the
compiler, and really, there are so many program-languages on this world
- one just has to be used to what is needed. To explode Gambas to a
standard OOP-language is a little too much, at this time at least, in my
opinion.

Regards,
Dag





More information about the User mailing list