On Fri, Feb 25, 2011 at 10:18 AM, john skaller
<skal...@users.sourceforge.net> wrote:
>
> Hmmm.. any thoughts?

I'm all for simplification of the innards of felix, so reducing
tuples, structs, and records down to the same thing sounds great to
me. Even better if we get rid of lvalues :) Now, on to the details:

> product sname { f1name: f1type; ... }

Is the "sname" is there so that we can say whether or not the product
type is nominally or structurally typed?

> struct X { a:int; long; b:int; }
>
> The padding long has a name: 1.

I'm not fond of this. I think either all field names must be provided,
or none are, or else it'd get confusing. Most people expect that
adding a field to a structure shouldn't cause code to break beyond the
construction, but changing the structure to this:

struct X { a:int; d:long; long; b:int; }

could result in some pretty subtle bugs.

> Field access is by
>
>  field value
>
> That is, the field name is an ordinary production function.
>
> Now, the notation
>
>  value . field
>
> is just reverse application. The only hassle is this:
>
> struct X { x:int; };
> fun x: X -> int = "1";
>
> var a: X = X (x=1;);
>
> println$ a . x; // which x?

Yeah, I can see that being confusing. Worse:

struct Vector { x:int; y:int; z:int };
var a: Vector = Vector (x=1; y=2; z=3);
val x = 2;

println$ a.x; // will it print 1 using the projection function, or 3
using the value of x to look up the third item in the structure?

> ...
> In other words instead of addressing and lvalues, we have pointers
> and deref only.
>
> Getting rid of lvalues is pretty cool. Note we STILL have variables we
> can store stuff in. The calculus is functional upto the assignment operation:
>
>        LHS <- RHS

This all sounds great. Will these pointer values be automatically
lowered to their pointed value, or will we always have to dereference
them? For example, will we be able to do:

cstruct X { x:int; y: int; };
val z = X (x=1; y=2;);
println$ z.x + z.y;

Or will we have to write:

println$ *(z.x) + *(z.y);

------------------------------------------------------------------------------
Free Software Download: Index, Search & Analyze Logs and other IT data in 
Real-Time with Splunk. Collect, index and harness all the fast moving IT data 
generated by your applications, servers and devices whether physical, virtual
or in the cloud. Deliver compliance at lower cost and gain new business 
insights. http://p.sf.net/sfu/splunk-dev2dev 
_______________________________________________
Felix-language mailing list
Felix-language@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/felix-language

Reply via email to