[Gambas-user] Suggestions 4 new keywords

Fabián Flores Vadell fabianfloresvadell at ...626...
Thu Sep 16 23:39:01 CEST 2010


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?

> 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.

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)

> (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.

> (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.

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


-- 
Fabián Flores Vadell
www.speedbooksargentina.blogspot.com




More information about the User mailing list