[E-Lang] ERTP-aware MintMaker

steve jenson steve@opencola.com
Wed, 14 Feb 2001 16:23:06 -0800


According to "E in a Walnut", and MarkM himself, there is going to be
a new keyword in the language called "describe" which will take care
of this sort of self-referencing issue. Therefore my code, while 
stylistically ugly, is the cleanest to fix upon completion of that
function to the language.

At least, that was my take on it. And I'll certainly concede to you having
picked a cleaner way of doing it if I hadn't known of forthcoming changes
to the language.

steve


Quoting hal@finney.org (hal@finney.org):

> I have a style question about the MintMaker:
> 
> >     var delayedMint := null
> >     define issuer {
> > ...
> >            delayedMint makePurse(0)
> > ...
> >      }
> >     define mint {
> > ...
> >                 to getIssuer :any { issuer }
> > ...
> >      }
> >     delayedMint := mint
> >  }
> 
> issuer needs to refer to mint, and mint needs to refer to issuer.
> This is done by creating this variable delayedMint, and having issuer
> refer to delayedMint, then at the end we set delayedMint := mint.
> 
> That seems kind of awkward, and will become more so when there are
> multiple peer functions which refer to each other.  Is it necessary due
> to the new "var" changes to E?  Without that, could you have done:
> 
>     define mint := null
>     define issuer {
>         <refer to mint>
>     }
>     define mint {
>         <refer to issuer>
>     }
> 
> This seems a bit more natural.
> 
> Perhaps, if we are stuck with the delayedMint style, it would be
> better to rename delayedMint to mint, and rename the function to _mint
> or some such, then do "mint := _mint" at the end.  Everywhere we would
> refer to mint rather than to _mint.  For consistency we would do the
> same thing with all the functions, such as issuer:
> 
>     // forward declarations
>     define issuer := null
>     define mint := null
>     // function definitions
>     define _issuer {
>         <refer to mint, issuer>
>     }
>     define _mint {
>         <refer to mint, issuer>
>     }
>     issuer := _issuer
>     mint := _mint
> 
> It's not all that pretty, but it will simplify the code in the body
> of the functions so that it can use the simplest names to refer to the
> other objects.
> 
> Hal

--
steve jenson
steve@opencola.com
PGP key available at: http://sieve.net/steve_oc.asc
PGP fingerprint: C7 08 5C 27 B7 CC 24 8F 7C 7D 57 A9 ED C6 5A A6 94 88 60 E9