Re: how test for empty sub-sequence?

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

----- Original Message -----
From: Bernie Ryan <bwryan at PCOM.NET>
To: <EUPHORIA at LISTSERV.MUOHIO.EDU>
Sent: Saturday, January 29, 2000 10:30 AM
Subject: Re: how test for empty sub-sequence?


> On Sat, 29 Jan 2000 08:29:12 -0500, Irv Mullins <irv at ELLIJAY.COM> wrote:
>
> >This kind of thing happens to all of us. Point is, it shouldn't have to
> >happen!
> >If we could specify the type of each subsequence, we would be warned as
> soon
> >as we tried to assign "Courier" to a subsequence which was previously
> >defined
> >to hold an integer or an atom.
> >
> >e.g:
> >MyFont = {string Name, integer Size, integer Style}
> >MyFont[Name] = 12 -- error
> >MyFont[Size] = "Courier" -- error
>
>   Irv
>
>   Why don't you use user define type ?

Of course, in this simple example, I could use:
type Font (object f)
    if sequence(f[Name]) and integer(f[Size]) and integer(f[Style]) then
       return 1
    else return 0
end type

Font MyFont
        MyFont = {"Dummy",0,0} -- required initialization

MyFont[Name] = "Courier" -- these are type-checked
MyFont[Name] = 12

The problem is that most of the variables that really need this kind of
checking
often are sequences with 20 - 50 subsequences. Some of the subsequences
contain
subsequences. This makes writing (and maintaining) type definitions more
work than it is worth, especially when you know you are going to turn type
checking off anyway, once the program is debugged, to prevent slowing things
down too much.

I have no objection to writing type definitions for user-defined types, but
it should
only be necessary to "declare" pre-defined types, not type check them
manually,
even when these pre-defined types are incorporated into a larger object or
sequence.

Irv

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

Search



Quick Links

User menu

Not signed in.

Misc Menu