On Tuesday 13 June 2017 22:29:21 Sieghard wrote:

> Using this as a reference, a syntax like
>
>   MethodType = object function (<parameterlist): <result type>;
> or
>   MethodVariable: object function (<parameterlist): <result type>;
>
> might be considered. Yes, this is more typing.
> (Perhaps abbreviate it with just usind a (leading) period? Like
>  ".function (<parameterlist): <result type>;" Nay, too C-ish...)
>
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

Reply via email to