Namespace (sort of)

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

> -----Original Message-----
> From: Irv Mullins [mailto:irvm at ellijay.com]
> Sent: Saturday, 23 June 2001 11:20 AM
> To: EUforum
> Subject: Re: Namespace Proposal

Hi Irv,


> 
> Here's the kind of thing that drives me back to Delphi: I 
> have a program
> that uses 4 files:
> customer.e
> supplier.e
> employee.e
> products.e
> 
> Each of the files has fields which are logically indexed by [NAME].
> Since the position of the [NAME] field differs in each file, 
> they all have
> to be
> fully qualified in their individual files:
> [CUST_NAME] = 2, [PROD_NAME] = 4, [EMP_NAME] = 1...

I agree. This is related to the namespace issue because Euphoria (almost)
forces you to pollute the namespace with lots of difficult names to help the
legibility of your code, and in the process makes it less legibile!

As an alternative, how about ...
  ----------------
  structure Customer
     sequence Name
     sequence Addr
     integer Zip
     sequence State
     sequence City
  end structure

  structure Employee
     atom PayCode
     sequence Supervisior
     sequence Name
  end structure

  Customer customer
  Employee employee
  
  printf(1,"...",{customer[Name],customer[Addr],
                  customer[City],customer[State],
                  customer[Zip],
                  employee[Name]...})
  -----------

> So I wind up with code like:
> 
> printf(1,"...",{customer[CUST_NAME],customer[CUST_ADDR],
> customer[CUST_CITY],customer[CUST_STATE],customer[CUST_ZIP],em
> ployee[EMP_NAM
> E]...}) -- erk!
> When using Pascal or Delphi, I can write the same thing as:
> 
> with customer do
>       writeln(name,addr,city,state,zip,employee.name)
>
> Which do you consider more confusing?

Point taken.

So maybe ...
  with customer 
    printf(1,"...",{[Name],[Addr],
                    [City],[State],
                    [Zip],
                    employee[Name]...})
  end with



-----------
cheers,
Derek Parnell
Senior Design Engineer
Global Technology Australasia Ltd
dparnell at glotec.com.au

---------------------




confidential information intended solely for the use of the individual or
entity to whom they are addressed. If you are not the intended recipient of
this message you are hereby notified that any use, dissemination,
distribution or reproduction of this message is prohibited. If you have
received this message in error please notify the sender immediately. Any
views expressed in this message are those of the individual sender and may
not necessarily reflect the views of Global Technology Australasia Limited.

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

Search



Quick Links

User menu

Not signed in.

Misc Menu