[Gambas-user] Suggestions 4 new keywords
Doriano Blengino
doriano.blengino at ...1909...
Thu Sep 16 07:57:08 CEST 2010
Fabián Flores Vadell ha scritto:
>
>> Your proposal resembles the syntax of pascal - I like pascal, and use it
>> a lot; but the biggest annoyance of pascal is this double declaration in
>> interface and implementation: very clean and very logical - for a
>> compiler from 1970.
>>
>
> Oh! Lisp come from fifties, but many current languages do not reach
> their ankles :-) (I'm not referring to Gambas)
>
I am not saying that because a language is old, it's bad. In fact, I
still think that pascal is hard to beat, if you embrace its philosophy.
And about lisp... wonderful! Especially for teaching. But how many
applications you find, written in lisp, nowadays?
>> I don't think that substituting PRIVATE and PUBLIC
>> with INTERFACE and IMPLEMENTATION would save typing, may be sometimes...
>>
>
> You forgot argue about your opinion. But, please, pay attention when
> you read: I'm saying about an << alternative >> syntax.
>
Ok, I will argue about it. From what I understand, the paradigm you
describe looks similar to pascal (and C++): an interface section
declares all the public symbols, which will be detailed (implemented)
later. So every method declaration must be written twice, in interface
and in implementation. And this alone is a lot of typing. When the
number of lines between interface and implementation grows to several
screens, you start to navigate up and down in the source. A good
editor/IDE can help, but the problem remains: why we have to write the
same things twice? Perhaps because a compiler born in the '70 could not
read the same source twice, especially if that source was punched on
cards... it is no surprise that a pascal compiler, on modern computers,
is so fast: the program is written in a way totally good for the compiler!
So, I prefer the gambas way - you write things once, exactly where you
want, and the compiler does the rest.
You say that your proposal is only an <<alternative>>. Ok. Even an
alternative, an option, must respond to good criteria. I am not saying
that your proposal is wrong - simply I think that probably it is not
what a gambas user expects. To let you know, I am probably the most
critic user of gambas - I am not afraid to point out its weaknesses. But
this time, I think that gambas is right.
>> The validation mechanism seems pretty, but does not add anything to the
>> more general form of getter/setter. Just more readable by a human (which
>> is not too little, anyway).
>>
>
> Yes. Nothing must be change in background. Just is about readability,
> and syntax closer to OOP
>
>
>> May be that there can be a midway idea: to have PUBLIC and PRIVATE
>> inherited from the last declaration. You specify PUBLIC at the
>> beginning, and then write variables and methods. Then you specify
>> PRIVATE, and then write all the private part of the class. This way, you
>> get closer to your proposal, still having the possibility to mix public
>> and private declarations.
>>
>
> I proposed exactly that, time ago to Benoît. But, because I'm
> referring to a alternative syntax closer to OOP, I think that
> INTERFACE and IMPLEMENTATION keywords are more accurated. That they
> exist in Pascal from nineties is just anecdotal, and not detract
> merits to them.
>
> A very important advantage, was not emphasized enough: keywords closer
> to OOP help very much to teaching an OOP language, because them are
> closely related to the OOP concepts.
>
Uhm... I don't understand why interface and implementation should be
related in any way to OOP. Don't forget that the gambas way of having
form=class=module/unit/library/whatever=file is a gambas specific
simplification. More mature languages can declare more than one class in
a file, or use more files to declare a single class. Interface and
implementation existed before OOP was invented, and OOP can live without
them; these two keywords are simply a way to group declarations - be
them OOP declarations or not.
I want to say just another thing. It seems that you are proposing
changes to gambas without having tried it enough. The same happened to
me - it is normal: you start to use something new, and many things are
different from what you expect or desire. A bit (or a lot) of adaptation
is needed - computers are not so powerful to adapt themselves to human
beings. After some time, and two or three non-trivial applications
written in gambas, you will change your mind - you will begin to
appreciate it more than now. If not, you will then, and only then,
entitled to criticize. I am not saying that gambas is perfect: I feel
that you and me share many thoughts about programming, but I repeat:
give gambas some time.
Regards,
Doriano
More information about the User
mailing list