Re: [MSEide-MSEgui-talk] MSElang Objects
On Tuesday 13 June 2017 22:29:21 Sieghard wrote: > Using this as a reference, a syntax like > > MethodType = object function (or > MethodVariable: object function ( > might be considered. Yes, this is more typing. > (Perhaps abbreviate it with just usind a (leading) period? Like > ".function ( What is wrong with "method" instead of "object function"? > > [Pascal-ish "with"] > > > The problem is that if there are members added to the referenced "with" > > container they override elements with the same name and type in existing > > code. > > Only if not explicitely qualified - you can always "break out" of the > current scope using qualifiers. For the current object, the qualifier > is always "self". And for elements outside of any object context, it is the > unit name. What's your problem then? and how should the Modula variant be > better in that respect? > Example: " unit widgets interface type pointty = record x,y: int32; end; cwidget = class() pos: pointty; end; " " unit test uses widgets; procedure test(); var widget: cwidget; left: int32; [...] with widget do pos.x:= left; end; " Now the author of the widget library adds a new property to "cwidget" " cwidget = class() pos: pointty; property left: int32 read pos.x write pos.x; end; " and brakes the functionality of your "test()" procedure. Martin -- Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot ___ mseide-msegui-talk mailing list mseide-msegui-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk
Re: [MSEide-MSEgui-talk] MSElang Objects
On Tuesday 13 June 2017 17:27:41 Edson H wrote: > Ok. I understand what Martin does. I have implemented this syntax too, in > my compiler. > > > I just was asking for the keyword ELSIF, to avoid nested IF, for several > comparisons, but Martin prefers to have a lot of THEN ... END, nested. I > think the best way is to include ELSIF, to have a clear syntax (like > Modula-2): > > > IF ... THEN > > > ELSIF ... THEN > > > ELSIF ... THEN > > > END; > > > And that's how it's implemented in my compiler, so it's compatible with > MSElang, except that MSElang doesn't support ELSIF. > It can be added to MSElang too, not yet decided. Martin -- Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot ___ mseide-msegui-talk mailing list mseide-msegui-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk
Re: [MSEide-MSEgui-talk] MSElang Objects
Hallo Martin, Du schriebst am Tue, 13 Jun 2017 06:47:58 +0200: > > [functions & procedures] > IIRC you proposed to use "function" for both? Sometimes I have the No. I did propose to use "function" _only_ if you _insisted_ to use the same keyword for both uses. If you kept the Pascal convention, only the better, I will _not_ protest. ["of object"] > I probably understand wrong, but do "SomeObjectMethod" > and "SomeMethodVariable" work with "SomeObject" only? That's not how > Delphi and MSElang method variables work. A method variable requires a specific "signature", i.e. parameter list, which belongs to a method of some specific object type. But I see your case - for commonly occurring signatures it might be desirable to define such variables independently of the destination type. On the other hand, I would really prefer some other syntax than this appendix, something more in line with the object declaration syntax. Even the Delphi creators themselves seem not to be happy with it, since they invented a completely different way for their later introduced "class methods". Using this as a reference, a syntax like MethodType = object function (> [WITH] > > > MSElang provides a safe "with" statement with mandatory local > > > qualifier. > > > > Something like the "Modula" version? > > I.e. effectively variable (object) renaming, without opening a new > > scope? > > Yes. [Pascal-ish "with"] > The problem is that if there are members added to the referenced "with" > container they override elements with the same name and type in existing > code. Only if not explicitely qualified - you can always "break out" of the current scope using qualifiers. For the current object, the qualifier is always "self". And for elements outside of any object context, it is the unit name. What's your problem then? and how should the Modula variant be better in that respect? > > > [...] > > > > > It has the advantage that procedure and method names are aligned. > > > > > More > > > > > > > > That _might_ be a disadvantage at times, as it might make reading > > > > the source text more difficult. > > > > > > Please explain. > > > > Citing you in ... > > It looks ugly. > > " > > You said. > > > That's not "it might make reading the source text more difficult". Yes, it is. When something "looks ugly" on first sight, it already _has_ distracted you from understanding what it _means_. You have to concentrate on the text explicitely to understand it, may be have to read it again. And above that, reading a, possibly long, list of all similar looking lines, it is not so easy to spot changes in those neatly aligned parts. (Which might be the reason that it "looks ugly".) -- -- (Weitergabe von Adressdaten, Telefonnummern u.ä. ohne Zustimmung nicht gestattet, ebenso Zusendung von Werbung oder ähnlichem) --- Mit freundlichen Grüßen, S. Schicktanz --- -- Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot ___ mseide-msegui-talk mailing list mseide-msegui-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk
Re: [MSEide-MSEgui-talk] MSElang Objects
Ok. I understand what Martin does. I have implemented this syntax too, in my compiler. I just was asking for the keyword ELSIF, to avoid nested IF, for several comparisons, but Martin prefers to have a lot of THEN ... END, nested. I think the best way is to include ELSIF, to have a clear syntax (like Modula-2): IF ... THEN ELSIF ... THEN ELSIF ... THEN END; And that's how it's implemented in my compiler, so it's compatible with MSElang, except that MSElang doesn't support ELSIF. De: Marcos Douglas B. SantosEnviado: domingo, 11 de junio de 2017 08:11 p.m. Para: General list for MSEide+MSEgui Asunto: Re: [MSEide-MSEgui-talk] MSElang Objects On Sun, Jun 11, 2017 at 4:58 PM, Edson H > wrote: No so much, but In Pascal you need to do: if ... then begin //WARNING: If use more than a sentence, you need BEGIN-END ... end //DANGER: Don't put semicolon! else if ... then begin //WARNING: If use more than a sentence, you need BEGIN-END ... end //DANGER: Don't put semicolon! else begin //WARNING: the same before. //some code end; //DANGER: Put semicolon! You're right about classic Pascal. I agree that is ugly. However, Martin is fixing this, always putting a semicolon no matter what. Besides that, the "begin" doesn't exists anymore, just "end". In other words, we will always have a "block" using if-then-end instead of if-then-begin-end. Marcos Douglas -- Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot___ mseide-msegui-talk mailing list mseide-msegui-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk