dotgnu-visionaries
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Visionaries] WebScheme


From: Peter Minten
Subject: Re: [Visionaries] WebScheme
Date: Sun, 11 May 2003 10:10:29 +0200

Peter Minten wrote:

> Hmm, this thread is getting really deep.

You said it man :-).

With the core language slowly moving into the nearly-but-not-yet stable zone
it's time to work on some loose ends. One major loose end are the field
modifiers like 'virtual' and 'class'. The rule is that field modifiers are
keywords. There are 3 types of fields: object fields, module fields and class
field. The following modifiers are allowed:

** Object field modifiers
1 [public]
1 [private]

** Module field modifiers
1 [public]
1 [private]

** Class field modifiers
1 [public]
1 [protected]
1 [private]
2 [virtual]
2 [abstract]

Modifiers with the same number in front of them cannot occur together.

The abstract modifier simply defines both accessors to be (lambda () (throw
(AbstractException.new some-text))).

Classes also have modifiers:

** Class modifiers

1 [abstract]

The abstract modifier can be used both in classes and fields, this is not
troublesome since the function that applies the metadata gets the object that
it's applied to and can thus find out if it's a Binding or a Class.

Modules don't have modifiers.

--

One powerful feature of WebScheme is the ability to give certain code certain
permissions. This is done using the [permission] attribute which is used like
this: [permission who what]. The who is done using symbols, there are the
symbols 'all, 'public, 'protected and 'private. The what is a symbol, one of:
'read, 'write and 'both (default, so you wont need this one often). If I write
[permission 'public 'read] [permission 'private 'both] that means everything
which would be able to see this field if it was declared public has read-only
access and everything which would be able to see this thing if it was declared
private has full-access. If both public and private access is possible (or
public and protected, protected and private) then the lowest (in this case
private) access is chosen.

The attribute [read-only] can be seen as [permission 'all 'read] [permission
'private 'write]. The attribute [constant] can be seen as [permission 'all
'read].

It's possible to use custom symbols like 'foo. To declare that a definition has
access level 'foo you can use [permission-role 'foo]. This works for classes and
all that jazz.

--

Inside accessors there is a special variable 'value' that is the value of
the field.

--

I'm adding a special value #nil, which evaluates to #f when evaluated in a
boolean context (like if). The predicate nil? returns #t if it's value is nil
and #f if not. Every object shall have a method nil?. In Scheme #f is used for
null values, which can be confusing, #nil eliminates this problem.

Greetings,

Peter



reply via email to

[Prev in Thread] Current Thread [Next in Thread]