Re: What has happened to comity

new topic     » goto parent     » topic index » view thread      » older message » newer message

Derek,

You seem to have neatly answered not only my thoughts, but David's as
well. Let us examine a little further.

<snip>

>I also support these ideas...
> a) a file can be included anywhere in the source text, not just at the file
>level.

This is what I would call the include as copybook concept, where the
include is merely a segment of code useful to repeat in various spots.

> b) an included file will only be ignored if it is included again in the
>same namespace and with the same "as" clause.

A necessary condition to prevent recursive prefixes.

>
>The use of these is to support code like this ....
>
>  function CloneCustomer( sequence custId)
>      include custofs.e
>      include custrec.e as current
>      include custrec.e as new
>
>      new.CustRec = EmptyCustRec
>      current.CustRec = fetchCustomer(custId)
>      if current.CustRec[Status] = kActive then
>          new.CustRec[Name] = current.CustRec[Name]
>          new.CustRec[Address] = current.CustRec[Address]
>          new.CustRec[PostalCode] = current.CustRec[PostalCode]
>
>          current.CustRec[WasCloned] = True
>          updateCustomer( custId, current.CustRec)
>      else
>          current.CustRec = fetchCustomer(kTemplateId)
>          new.CustRec[Name] = current.CustRec[Name]
>          new.CustRec[Address] = current.CustRec[Address]
>          new.CustRec[PostalCode] = current.CustRec[PostalCode]
>      end if
>
>      new.CustRec[CreateDate] = Today()
>      new.CustRec[CreateTime] = Now()
>
>      return new.CustRec
>
>  end function
>
>where "custrec.e" is ...
>  global sequence CustRec
>  global sequence CustAltIndex
>
>where "custofs.e" is ...
>  global constant Name = 1,
>           Address = 2,
>           PostalCode = 3,
>           WasCloned = 4,
>           Status = 5,
>           CreateDate = 6,
>           CreateTime = 7,
>           EmptyCustRec = {"", "", 0, 0, kNewRecord, 0, 0}

Well, it appears that you have recreated structures here. I would rather
have a more formal structure definition, with named elements, but this
with prefixes certainly is better than what we have.

>though even better would be an "export" clause rather than "global", that
>only exposed the identifiers to the namespace that the include file was in.

This is where it gets tricky. With your method, global would still be
available. With Davids "octothorpe"(pound sign to us normal humans) prefix
on the include, it modifies the whole include to the local scope. Maybe
some combination of these two concepts would be the most flexible.

Everett L.(Rett) Williams
rett at gvtc.com

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu