Re: Homogeneous sequence

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

CChris wrote:
> 
> Is't it easier for the compiler to see the whole of the daisy chain, and 
> optimise as you said, if the type is presented as a whole?
Maybe. One of my nagging questions is this:
type ssm(sequence of sequence of myudt q) return 1 end type
ssm k
object z
    k[5]=z

After the assignment, where exactly do you type-check s[5]? If the programmer
was forced to create a type sm and use that in the definition of type ssm, the
answer would be obvious. Without it, well you are going to need a new typecheck
opcode that contains a for loop anyway, but then that would have to become
nested/recursive. At the end of the day it may be six of one and half a dozen of
the other, but the lack of a named type to declare z with, and the corresponding
extra type checks which will therefore need to be issued, swings it for me.

> Otherwise, the compiler has to reassemble a few nested type declarations
More a question of walking down an existing chain, I think. This stuff already
works so I thought of piggybacking onto it:
type positive_int(integer pi)
    return pi>=0
end type
type minute(positive_int m)
    return m<=59
end type
type even_min(minute em)
    return and_bits(em,1)=0
end type
type odd_min(minute om)
    return and_bits(om,1)
end type
odd_min z


> Because of the overhead of testing for it, because there is no example of 
> such limitations in Eu
Ah, but is there any similar precedent of such redundancy in Eu?
Anyway, it is just my [unshakeable] opinion it should error out.

Regards,
Pete

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

Search



Quick Links

User menu

Not signed in.

Misc Menu