On 10/06/2012, at 10:15 AM, john skaller wrote:

> I'm in the middle of rewriting the pointer model.


First: DEVELOPERS NOTE BREAKAGE INVISAGED.

This means I may have just broken your code, and,
the new modelling stuff is certainly deficient and probably 
bugged as well :)

There are now 3 types of pointers:

        &T : your usual pointer to an object
        @T: a pointer to an object or NULL
        +T: an array element pointer, can be incremented, can't be NULL

The type &T has a typedef ptr[T].
The type @T is a union Ptr of &T | nullptr.
The type +T is an abstract type with (unsafe) increment ops,
  typedef carray[T].

The primary use (temporarily!!) for the new types is

        +char

which is a pointer to an array of char. [This will be replaced
later with a proper ntbs array, since we actually can find
the length of a nul terminated string]

The following operations are available (temporarily!):

        +px // convert &T pointer to +T pointer: SAFE
        -px // convert +T pointer to &T pointer: UNSAFE

Note that the SAFE conversion +px is dangerous because
you can now increment a pointer to a single object. BAD IDEA!
But  the cast itself is safe.

The UNSAFE conversion is unsafe because now you think
you can safely dereference the &T pointer, but if has
gone "past the end" of an array or something, you can't.
However, if the pointer does point at an object, the cast
is safe.

So roughly neither of these conversions are safe to use.

They're needed at least temporarily to "hack" existing code
quickly to make it work.

Impetus:

The reason for all this is to get this to work:


var x = ( (1,2,3), (4,5,6) );
var y = transpose x;

y is now ( (1,4), (2,5), (4,6) )

The transpose operation subsumes zip.


--
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