Looks like I may have to change arrays (not sure about tuples)
so that length 1 arrays can exist. I have code that uses an array and
it needs to be able to go to length 1 (or even 0).

This means rather than everything being an array, a tuple
of elements of the same type will no longer be an array
(it will have to be coerced).

The impact of an attempt to unify value = value ^ 1 is that overloads
on arrays preciude other overloads:

        fun f(x:int) => ..
        fun[N] f(x:int^N) =>

this isn't ambiguous since the first one is more specialised, but both would
match a call

        f 1; // int or int^1?

When i implement the isomorphism, a lot of array stuff breaks,
its very hard to see exactly why, given the "more specialised"
rule, although perhaps that rule isn't being implemented for
this case correctly.

The problem isn't unique to size 1, and it affects C++ too
(type based overloading is technically rubbish).

        fun f(x: T * T) => ...
        fun f(x:T, y: size) => ...
        f (1.size, 2.size)

with T -> size both signatures match. The second should be called
because it is more specialised .. which may not be what was expected
(this actually happened to me in the past).

Of course there are ways around it, like named parameters,
records, more explicitly named functions. So I'm still not sure,
but it's not looking good. My example, something like

        T * T ^ N

has to work for N=1.

--
john skaller
skal...@users.sourceforge.net
http://felix-lang.org




------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Felix-language mailing list
Felix-language@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/felix-language

Reply via email to