The function len:string->int is changed to len:string->size for consistency with arrays and typeclass arrangements. The general rule is that lengths of containers should use the "size" type because that's what it is for.
It's a serious pain that literal integers 123 etc are ints so you have to write things like: if len s > 0 do for var i in 0uz upto len s - 1uz do .. Not only do you have to use 0u, 1uz to get the typing correct, since size is unsigned, you cannot rely 0uz < s.len - 1uz when s.len == 0uz, in fact (-1).size is the maximum unsigned value that fits into size. So you need the zero test as well. Google actually uses "int" for lengths, probably because it makes it easier to write loops that actually work, at the cost of not handling massive data structures. It's not correct but it seems practical. The only real context where this would fail would be some kind of address space mapping facility on a microcontroller. Still .. we like to do things "right" whatever that means. Unsigned sizes simplify bounds checks. OTOH we allow signed integer indices to be used and we actually lose the ability to check properly that way. Note that "len x" has a fixed type, it can't be polymorphic because it's an output. Anyhow, be aware of the change: strings are used a lot. The easiest fix is: len s --> s.len.int [That postfix notation is a lot nicer than prefix application IMHO :] -- john skaller skal...@users.sourceforge.net ------------------------------------------------------------------------------ Ridiculously easy VDI. With Citrix VDI-in-a-Box, you don't need a complex infrastructure or vast IT resources to deliver seamless, secure access to virtual desktops. With this all-in-one solution, easily deploy virtual desktops for less than the cost of PCs and save 60% on VDI infrastructure costs. Try it free! http://p.sf.net/sfu/Citrix-VDIinabox _______________________________________________ Felix-language mailing list Felix-language@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/felix-language