Unifying T = T^1 (automatically) is a *bad* idea. Maple has had this for 25+ years, and all it brings is pain and confusion.
I think it would be better to treat things via functorial properties -- so if a function knows how to map itself, then for all purposes T^1 will behave like T (i.e. in Haskell terms, fmap behaves like application). Basically even though T and T^1 are canonically isomorphic, it is still not a good idea to remove the 'dimension' component of T^1 entirely, as you lose uniformity of behaviour of arrays then. [You have discovered a number of these things yourself, as I see from your emails, I am just giving you what I know from experience] Jacques On 21/07/2012 1:51 AM, john skaller wrote: > 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 ------------------------------------------------------------------------------ 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