comp.lang.ada
 help / color / mirror / Atom feed
* Extention of names scoping (autodelegation)
@ 1998-07-08  0:00 amir
  0 siblings, 0 replies; only message in thread
From: amir @ 1998-07-08  0:00 UTC (permalink / raw)


I am doing low-level staff and C++ is the most suitable tool for me now. But
I want something better. All newer languages are oriented for frameworks and
ignore my needs. The C9X draft contain nothing important. I have various
ideas about language I want but I never would have time nor have enough
experience to build complete definition. So I post this in hope somebody
will pick it up.

Standard name scoping:
type typeA { A1, A2: something }
type typeB { B1: typeA }
var B:typeB;
usage: B.B1.A1:=B.B1.A2 or with B.B1 { A1:=A2 }

Proposed extentions:
1) Synonyms.1
type typeB { B1:typeA; B2=B1.A1 }
type typeB { B1:typeA; =B1.A1 } -- shortcut for A1=B1.A1

2) Open members:
type typeB { B1::typeA } -- A1 & A2 delegated, B.A1:=B.A2 now legal
type typeB { B1::typeA; A1:something } -- A2 delegated, A1 not
type typeB { B1::typeA; B2::{ A1:something } } -- A2 delegated, A1 not
(because of conflict)
    in last B.A1 is undefined but B.B1.A1 & B.B2.A1 still legal
type typeB { { B1::typeA; } B2::{ A1:something } } -- unnamed block decrease
the priority of delegates, so B.A1 mean B.B2.A1and B.A2 mean B.B1.A2
    note: A {B} {{C}} dont work, should be A {B {C}}

3) Synonyms.2
type typeC { C1:typeB; C2==C1.B1 } -- C2 is open, C.A1 & C.A2 legal
type typeC { C1:typeB; ==C1.B1 } -- shortcut for B1==C1.B1 or just opening
of it without definition of B1? I am not sure.
type typeC { C1::typeB; A1= } -- undefine A1
The necessary restriction is that every use of synonyms must be resolved to
some actual names.

Now we can construct type system

1) Types -- precisely describe the layout of data in memory. Records,
variants, arrays.
type typeA { Count:int; Items::[20] typeItem } -- index operation delegated
    A[-1] return some part of Count :)
No virtuals. Access to const members (attributes), fields and parameterless
functions are uniform.

2) Type extentions -- can define overlapped fields, const, synonyms and
methods, cannot change layout.
with typeA extA {
    Tag:tagType; -- overlapped with Count
    First=Item[0];
    proc Last return typeItem { Result:=Items[Count] }
}
Everywhere extA visible, typeA.Tag and others are defined.
Various extentions of typeA are combined as open members
    typeA: { extA1:: extA2:: extA3:: }
Concrete extention can be used A.extA.Tag
Anonimous extentions are allowed but every one is distinct.

3) Interfaces -- abstract sets of propeties and methods. No data fields.
interface faceA {
    State:int; -- read-write property
    <Statistic:int; -- read only
    Command>:int; -- write only
    proc Connect(Other : Same);
}
Interfaces can be combined by structured way or by set operations. Interface
can be build upon type or variable, if it have proper set of defined fields
and methods. Some interface members can be specified a la synonims others by
names.

4) Interface pointers -- multy-method closures, dinamic dispatch. Its your
question, did the interface contain IUnknown.

Some minorities:
postfix operator@ -- self assigment:
x@+1; max(x@,0); head.next@.next; some.long.x@*@+2*@+1; ??? :)

What do you think?
Amir

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp   Create Your Own Free Member Forum




^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~1998-07-08  0:00 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1998-07-08  0:00 Extention of names scoping (autodelegation) amir

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox