On 02/07/2013, at 2:53 PM, srean wrote:

> Runtime array access checks slows down numeric code, especially when you are 
> trying to get as much flops as possible. I like the possibility of static 
> checks without a runtime hit.

Felix provides both checked and unchecked access (depending on the
kind of array like thing). Library functions typically use unchecked access
because, for example, they're driven by loops to the array length.

Actually I have a problem with loops. The basic for loop:

        for var i in 0 upto limit - 1 do .. done

works fine but this doesn't:

        for var i in 0uz upto a.len - 1uz do .. done

Why? Because if len is 0, len - 1uz is the maximum size value.

It isn't possible to have a single loop which handles

        (a) signed indices and unsigned indicies, and,
        (b) both 0 and max value

Note also Felix substrings are

        s.[first to past-the-end]

use integers not size type, hand negative values and
out of range without error (but cannot span a really
big string because "int" is 32 bits on all supported 64 bit
platforms).

I have found several bugs in the library over the len - 1 problem:
an explicit zero check is needed.

It would be really good to fix this. C loops are more general:

        for  ( initi; test; increment)

which is why I do NOT like them. however there's no problem
with either (a) or (b) as such, the programmer just has to do
the right thing.

Felix uses "size" = C's size_t = unsigned 64 bit int for sizes.
Google on the hande mandates "int" everywhere. Its probably
faster and the -1 value helps loops work, at the cost of needing
something else for super big things.

So this mess is a design fault I'd like to fix, only I don't know how.

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




------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev
_______________________________________________
Felix-language mailing list
Felix-language@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/felix-language

Reply via email to