<?xml version="1.0" encoding="UTF-8"?>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://purl.org/rss/1.0/" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:syn="http://purl.org/rss/1.0/modules/syndication/" xmlns:admin="http://webns.net/mvcb/">
  <channel rdf:about="http://blog.gmane.org/gmane.comp.lang.felix.general">
    <title>gmane.comp.lang.felix.general</title>
    <link>http://blog.gmane.org/gmane.comp.lang.felix.general</link>
    <description/>
    <syn:updatePeriod>hourly</syn:updatePeriod>
    <syn:updateFrequency>1</syn:updateFrequency>
    <syn:updateBase>1901-01-01T00:00+00:00</syn:updateBase>
    <items>
      <rdf:Seq>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.comp.lang.felix.general/2930"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.comp.lang.felix.general/2929"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.comp.lang.felix.general/2928"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.comp.lang.felix.general/2927"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.comp.lang.felix.general/2926"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.comp.lang.felix.general/2925"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.comp.lang.felix.general/2924"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.comp.lang.felix.general/2923"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.comp.lang.felix.general/2922"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.comp.lang.felix.general/2921"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.comp.lang.felix.general/2920"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.comp.lang.felix.general/2919"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.comp.lang.felix.general/2918"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.comp.lang.felix.general/2917"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.comp.lang.felix.general/2916"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.comp.lang.felix.general/2915"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.comp.lang.felix.general/2914"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.comp.lang.felix.general/2913"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.comp.lang.felix.general/2912"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.comp.lang.felix.general/2911"/>
      </rdf:Seq>
    </items>
    <image rdf:resource="http://gmane.org/img/gmane-25t.png"/>
    <textinput rdf:resource=""/>
  </channel>
  <image rdf:about="http://gmane.org/img/gmane-25t.png">
    <title>Gmane</title>
    <url>http://gmane.org/img/gmane-25t.png</url>
    <link>http://gmane.org</link>
  </image>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.lang.felix.general/2930">
    <title>Extending flx_pkgconfig</title>
    <link>http://permalink.gmane.org/gmane.comp.lang.felix.general/2930</link>
    <description>&lt;pre&gt;I'm extending the capabilities of flx_pkgconfig, so it can query pkgconfig (*.pc)
databases.

pkgconfig is a seriously bad program. It is very badly written,
it is full of bugs, and it has limited capabilities (which is why
flx_pkgconfig was written). Indeed, it has a very specialised application
and it can't even handle that properly.

I have extended flx_pkgconfig (next commit) to add;

--help

well it should always have had that ..

--extension=fpc

to set the extension to look for, if you set pc it will find pkgconfig files
instead of flx_pkgconfig files (will play with this to see if both can
be queried at once later).

I have added variables as used by pkgconfig:

prefix = /usr/local
lib = ${prefix}/lib

Libs: -L${lib} -lmylib

Also blank lines are tolerated, and lines starting with # are skipped.
pkgconfig allows trailing # comments which are not handled yet.

Pkgconfig also doesn't allow comma separators: some options go
like this:

-W1,linkeropt,-W1

and have embedded commas, so I'll have to remove that feature.
Some convenience flags such as --cflags can be added later.

A couple of stupid features not supported yet: splitting linker switches
into -L  and -l. Probably support that by filtering values based on
a regexp (although at this point, flx_pkgconfig is very carefully built
to avoid using any regexps).

One of the biggest problems is version control. In pkgconfig, a Version
field provides the version, and you can write:

Requires: fred &amp;lt; 1.2.11
Requires: joe = 2.3.4

This makes the "Requires" field special (since the version requirement isn't in the
correct form of a general field). Also breaks the dumb parsing I'm using for variables
(which would think the last line is an assignment of 2.3.4 to variable "Requires: joe" :)

However with enough hacks and tweaking, flx_pkgconfig can probably be made
a "drop in" replacement for pkgconfig.

--
john skaller
skaller-Rn4VEauK+AKRv+LV9MX5uipxlwaOVQ5f&amp;lt; at &amp;gt;public.gmane.org
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/
&lt;/pre&gt;</description>
    <dc:creator>john skaller</dc:creator>
    <dc:date>2012-05-24T10:53:08</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.lang.felix.general/2929">
    <title>Re: [felix] ncurses on OS, a note</title>
    <link>http://permalink.gmane.org/gmane.comp.lang.felix.general/2929</link>
    <description>&lt;pre&gt;
On 24/05/2012, at 2:39 PM, john skaller wrote:


Grrrrrrrr   ... but only just. The arrow keys work.
but on the **^&amp;amp;%^$$ ing MacBookPro, with its utterly stupid half size
arrow keys and missing Home/End keypad keys, and ridiculous
additional Apple key .. none of the other combinations (like Shift Left Arrow,
which is marked "Home" on the keyboard) work, they just emit stupid
escape sequence that xterm-color doesn't grok.

The terminal program allows mapping these combinations to anything,
and works with just about any terminal type, but it's a major pain now
to go find what the terminfo data base says (since its compiled ..)
and fix the keys.

It's probably easier to add a "learning mode" to the application so
you can just press the key you want for each function.

Keyboard mapping is a pain. Keyboard mapping when 10 different 
application and OS layers intervene is a nightmare.


--
john skaller
skaller-Rn4VEauK+AKRv+LV9MX5uipxlwaOVQ5f&amp;lt; at &amp;gt;public.gmane.org
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/
&lt;/pre&gt;</description>
    <dc:creator>john skaller</dc:creator>
    <dc:date>2012-05-24T10:19:25</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.lang.felix.general/2928">
    <title>Re: [felix] ncurses on OS, a note</title>
    <link>http://permalink.gmane.org/gmane.comp.lang.felix.general/2928</link>
    <description>&lt;pre&gt;
On 24/05/2012, at 2:29 PM, john skaller wrote:



Grrr .. works now I call keypad() *after* initscr :)

--
john skaller
skaller-Rn4VEauK+AKRv+LV9MX5uipxlwaOVQ5f&amp;lt; at &amp;gt;public.gmane.org
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/
&lt;/pre&gt;</description>
    <dc:creator>john skaller</dc:creator>
    <dc:date>2012-05-24T04:39:50</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.lang.felix.general/2927">
    <title>ncurses on OS, a note</title>
    <link>http://permalink.gmane.org/gmane.comp.lang.felix.general/2927</link>
    <description>&lt;pre&gt;I'm writing some ncurses stuff to perhaps help manage Felix
installations etc. 

I found the installed version on OSX doesn't work. I found this note:

http://www.uponmyshoulder.com/blog/2010/fix-ncurses-in-os-x-10-6-3/

and I'm trying it out. Nope. Press an arrow key and still get the f'ing escape
sequence, not interpreted by ncurses as it should be.

Unix is such .... Terminals. Ye gads, how utterly archaic is this concept?
We've had actual keyboards and screens on PCs for a while.

Ah well. No idea how to proceed, except perhaps make a Felix
resource data base to replace the crap. I note, the terminal emulators
all work fine.



--
john skaller
skaller-Rn4VEauK+AKRv+LV9MX5uipxlwaOVQ5f&amp;lt; at &amp;gt;public.gmane.org
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/
&lt;/pre&gt;</description>
    <dc:creator>john skaller</dc:creator>
    <dc:date>2012-05-24T04:29:30</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.lang.felix.general/2926">
    <title>windows utils</title>
    <link>http://permalink.gmane.org/gmane.comp.lang.felix.general/2926</link>
    <description>&lt;pre&gt;gnuwin32.sourceforge.net/

--
john skaller
skaller-Rn4VEauK+AKRv+LV9MX5uipxlwaOVQ5f&amp;lt; at &amp;gt;public.gmane.org
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/
&lt;/pre&gt;</description>
    <dc:creator>john skaller</dc:creator>
    <dc:date>2012-05-23T12:42:23</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.lang.felix.general/2925">
    <title>automagical record coercions (record subtyping)</title>
    <link>http://permalink.gmane.org/gmane.comp.lang.felix.general/2925</link>
    <description>&lt;pre&gt;At present if you have a function accepting a record with
the set of fields F, you can call it with a record with
the set of fields G, provided F is subset of G, and,
you *explicitly* coerce G to F:

typedef F = (a:int);
typedef G = (a:int, b:int);
fun f(x:F)=&amp;gt;x.a;
var g = (a=1, b=2);
println$ f( g :&amp;gt;&amp;gt; F);

If you leave off the coercion, you will get this:

Client Error binding expression (f g)
CLIENT ERROR
[lookup_name_with_sig] Can't find f of struct  {a:(int);b:(int);}
In /Users/johnskaller/felix/./ft.flx: line 5, cols 9 to 10
4: var g = (a=1, b=2);
5: println$ f( g);
           **
6:


There's an argument to provide "some kind of subtyping" here:
a G "is an F" (it just has extra fields). The coercion we use has
a common generic name in algebra: "the forgetful functor",
which is a structure preserving map that simply "forgets" some
of its domains structure.


If we could do automagical coercions, you could write "generic"
functions and just call them with any record which extended
the parameter type, without having to bother with the coercion.

If there were multiple matches, then we can use the "best match"
rule we currently use, but applied to record specialisations instead
of type variable specialisations: if one coercion forgets fields X
to make a match, and another forgets fields X \cup Y we'll pick the
one that forgets the least fields, namely the one that merely forgets X.

Note that X is a strict subset of X \cup Y: two coercions H and K are
only comparable if, of the set of fields they forget, one is a subset
of the other.

Now, the problem I have implementing this is it appears at first
glance to require a "hack" to the unification algorithm. Unification
solves for type variables. Specialisation is a modification of unification
that specifies some type variables are independent, and some dependent.
Independent types variables are regarded as existential, that is,
they're actually fixed but unknown types, and so we're not allowed
to replace them. For example

parameter = int * v 
argument = w * int

unification generally would provide a solution 

v = int
w = int

but we do not wish to allow that, we only want to allow specialisation,
we don't want to allow w to be replaced, only v. Roughly in the equation:

int * v = w * int

we only want to allow variables on the LHS to be replaced, so in this case
there's no solution.

Because of the way the unification algorithm works, it isn't possible to just
ask for "only substitutions of variables on the LHS" because sometimes
variables on the RHS get put on the LHS by a substitution, so we have
to list the dependent variables we want to solve for.

Ok, so, the point is just saying "we want to allow the LHS to unify with the
RHS if the LHS is a record and the RHS is a record with more fields" will
not work. In fact all hell would break loose.

So I'm thinking of this solution: if the LHS is a record, we just replace
it with a new dependent variable. Then, unification will match ANY type.

Then, AFTER we have got the result back from unification, we apply the
subtyping rule as a constraint. So, suppose we have

typedef F = (a:int);
typedef G = (a:int, b:int);
fun f(x:F)=&amp;gt;x.a;
var g = (a=1, b=2);
println$ f( g );

then we match f[v] of (v) instead of f of F.
We get a match with most general unifier (mgu) 

v -&amp;gt; G

Now we apply the constraint:

F is subtype of G

which in this case passes: f is a candidate.

It's vital to know that this subtyping doesn't necessarily apply in general.
It *could* apply for records nested in records and tuples provided we're
willing to reconstruct the whole top level record or tuple with a sliced back
component.

More on this later. However the proposal is to hack the overloading
algorithm to change record argument to a variable and retrofit
the record subtyping rule as a constraint.


--
john skaller
skaller-Rn4VEauK+AKRv+LV9MX5uipxlwaOVQ5f&amp;lt; at &amp;gt;public.gmane.org
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/
&lt;/pre&gt;</description>
    <dc:creator>john skaller</dc:creator>
    <dc:date>2012-05-22T00:07:35</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.lang.felix.general/2924">
    <title>Re: type checking</title>
    <link>http://permalink.gmane.org/gmane.comp.lang.felix.general/2924</link>
    <description>&lt;pre&gt;On Sun, May 20, 2012 at 2:37 PM, john skaller
&amp;lt;skaller-Rn4VEauK+AKRv+LV9MX5uipxlwaOVQ5f&amp;lt; at &amp;gt;public.gmane.org&amp;gt; wrote:

some day! for my day job, i'm stuck in java, and for my
extra-curricular work, i'm stuck in python &amp;amp; haxe for a while yet...
:-)

------------------------------------------------------------------------------
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/
&lt;/pre&gt;</description>
    <dc:creator>Raoul Duke</dc:creator>
    <dc:date>2012-05-21T15:58:59</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.lang.felix.general/2923">
    <title>type checking</title>
    <link>http://permalink.gmane.org/gmane.comp.lang.felix.general/2923</link>
    <description>&lt;pre&gt;
On 21/05/2012, at 12:22 AM, Raoul Duke wrote:


It's more than that: at least Hindley Milner inference can't handle
everything you want, eg monomorphisation restriction, can't
pass polymorphic functions, etc. In Ocaml I find the biggest problems:

(a) I don't know what the a type a function argument is, my solution
is to write "blob" and then look at the error message :)

(b) I get an error on correct code, because some incorrect code
somewhere fixed the type, and the ocaml system isn't smart enough
to tell me where it deduced the type.

I believe some limited mixing of overloading and inference is possible,
but the two features tend to conflict.

Also, I believe correct programming is related to thinking properly
about types and for me that's easier if I can see encodings of them
in a few places.



Well you should try that in Felix and let me know what needs to be
done to make the conversion reasonably simple, and the result
as readable (or more readable :)

Particularly attention to portability of the script, i.e. so it works
on both Unix and Windows.

--
john skaller
skaller-Rn4VEauK+AKRv+LV9MX5uipxlwaOVQ5f&amp;lt; at &amp;gt;public.gmane.org
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/
&lt;/pre&gt;</description>
    <dc:creator>john skaller</dc:creator>
    <dc:date>2012-05-20T21:37:15</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.lang.felix.general/2922">
    <title>Re: Java in Felix</title>
    <link>http://permalink.gmane.org/gmane.comp.lang.felix.general/2922</link>
    <description>&lt;pre&gt;
syntax is the vietnam of programming languages? ('course in viet nam
it was called appropriately enough 'Resistance War Against America')

------------------------------------------------------------------------------
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/
&lt;/pre&gt;</description>
    <dc:creator>Raoul Duke</dc:creator>
    <dc:date>2012-05-20T14:29:45</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.lang.felix.general/2921">
    <title>Re: [felix] Re: Objects in Felix</title>
    <link>http://permalink.gmane.org/gmane.comp.lang.felix.general/2921</link>
    <description>&lt;pre&gt;On Sat, May 19, 2012 at 11:44 PM, john skaller
&amp;lt;skaller-Rn4VEauK+AKRv+LV9MX5uipxlwaOVQ5f&amp;lt; at &amp;gt;public.gmane.org&amp;gt; wrote:

well, they do use sexprs at least. code that is written to take
advantage of loosey goosey forms of dynamic typing with runtime
autocasting would presumably be hard to convert no matter what the
surface syntax is? so i'd guess that if the standard libraries are
written to take advantage of that, and do things like have differing
return types for the same routine depending on overall state, then
those would be hard to type/tame. clojure uses the jdk so that might
make it easier overall than it was for racket? haven't used either
enough to recall how loosey goosey their typing is.

philip wadler had a paper about making a type system that lets you
have a firewall between dynamic and static code that statically
guarantees the dynamic code can't break the static code, i think. so
that was another interesting tool along the range of dynamic/static.

shen/qi-lisp offer both an untyped and a type checked mode, although i
haven't mucked enough with them to understand the difference there
yet; i *think* it is starting with a dynamic language assumption and
then implementing a (sorta prolog based) type checker in that system,
to optionally check programs you write in it.

for me i want things typechecked from the get-go. :-) having an
inference engine in there is nice, although mostly i think the
real-world experience is that you might as well put in types manually
along the way. otherwise the errors you get are weird and confused.
but at least inference lets me write a replacement for my 10 line bash
scripts w/out the ascii overhead.

------------------------------------------------------------------------------
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/
&lt;/pre&gt;</description>
    <dc:creator>Raoul Duke</dc:creator>
    <dc:date>2012-05-20T14:22:51</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.lang.felix.general/2920">
    <title>Java in Felix</title>
    <link>http://permalink.gmane.org/gmane.comp.lang.felix.general/2920</link>
    <description>&lt;pre&gt;And here was have it:


// define an interface with one method

interface A { 
  geta: unit -&amp;gt; int; 
}

// extend it with a second method

interface B extends A { 
  getb: unit  -&amp;gt; int; 
}

// implement a class for the first interface A

object anA (a:int) implements A = { 
  omethod fun geta()=&amp;gt; a; 
}

// implement a class for the extended interface B,
// by inheriting from the class 'anA' we just defined

object anB(a:int, b:int) extends anA(a) implements B = { 
  omethod fun getb()=&amp;gt; b;
}

// Apply the class constructor to make an object

var bb = anB(22,33);

// prove it does what we expected

println$ bb.geta(), bb.getb();
 

Ok, so: I'm thinking of tweaking the syntax more of course.

'face' instead of interface because I've been interfacing
with facebook for too long.

'obj' instead of 'object' so no one can claim Felix is actually
object oriented.

'omethod' need to be replaced. Perhaps "method" or
just "meth" would do, though the latter suggests the drug
of choice for the very poor or the very rich.

Now, I have to say I hate { .. } more and more, tempted to do

face .. endface
obj ... endobj

instead. Any suggestions to improve the look and feel most welcome.
Note the ugly "=" sign. That comes from 

fun f(x:int) : int = { .. }

The = is required here because 

int { .. }

is a valid expression syntactically. I like

fun f(x:int) : int 
  begin ... end

better but I'm archaic, Pascal was my first language :)

Actually, I'm not sure why it isn't needed in:

interface A extends B  { .. }

since an interface is nothing more than a typedef of a record,
there's no reason that B should be a name, it can be any
expression (that resolves to a record type).

Maybe the syntax is a left over from the old Ocamlyacc parser,
which was only LALR(1). Dypgen might handle it better,
allow the = to be elided.

Anyhow .. as they say .. enjoy! :)

--
john skaller
skaller-Rn4VEauK+AKRv+LV9MX5uipxlwaOVQ5f&amp;lt; at &amp;gt;public.gmane.org
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/
&lt;/pre&gt;</description>
    <dc:creator>john skaller</dc:creator>
    <dc:date>2012-05-20T14:01:52</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.lang.felix.general/2919">
    <title>Objects in Felix: Value extensions</title>
    <link>http://permalink.gmane.org/gmane.comp.lang.felix.general/2919</link>
    <description>&lt;pre&gt;
On 20/05/2012, at 7:05 PM, john skaller wrote:


And I missed the fun part:

var xt = extend x,y, (a 1) with d end;
println$ xt.getit();

var xt2 = extend x,y, (a 1) with (object () = { omethod fun getit() =&amp;gt; "it2"; }) () end;
println$ xt2.getit();


var objk42 = extend x,y, (a 1) with (object (var k:int) = { omethod fun getk() =&amp;gt; k; }) 42 end;
println$ objk42.getk();

Note that we're synthesising new objects. The "object" construction is NOT an object,
its an object FACTORY (i.e. a function returning an object .. which is just a record).

It's the same as a Java (or C++) class: you have to call the "constructor" on arguments
to get an actual object.

Is this what we really want? 

Certainly, the above is useful. But really, I think we wanted to merge together
the object factories, not objects, to get a new factory.

In other words we want to merge

T1 -&amp;gt; R1
T2 -&amp;gt; R2
...
Tn -&amp;gt; Rn

into

T1 * T2 * ... * Tn -&amp;gt; R

where R is the the merger of the record types R1  to Rn.

Alternatively, instead of T1 * .. * Tn we might want

T1 * .. Tn-1 * pn1 * pn2 ....

where pn1, pn2 .. are the individual components of the tuple argument Tn

or perhaps we want

T

where T is the merge of the tuples T1 .. Tn (i.e. a tuple with all the individual arguments).

In C++, your constructor reads:

T(p1, p2, .. pn) : T1(...), T2(...) ... v1(..), v2 (.. ) { .. }

where the initialisers for the bases T1 to Tn-1 are calculated from constants
and the parameters p1 .. pn, ditto for member variables v1 .. vm.

Now of course, with the extend expression you can just do:

fun f(...) =&amp;gt; extend T1(...), T2(...), ... Tn-1(...) with (object ... ) (...) end;

so it's not clear if a syntax

object Tn(...) extends T1(..), T2(...), ... = { omethod ... };

is worthwhile. Hmmm. Perhaps I should try. That seems the right form.
each of T1(...) etc is actually an object, except the arguments are parameters
of Tn (as in C++). However if you note the value extension syntax again:

var objk42 = extend x,y, (a 1) with (object (var k:int) = { omethod fun getk() =&amp;gt; k; }) 42 end;

it's not so easy to see how this will work (the parameter here is k, and is only available
to the derived object not the bases). Hmmm.. so we need instead the model:

fun X (params) = {  return extend ... object ... end arg; }

Ah yes. That's nice. Trivialish in the parser!




--
john skaller
skaller-Rn4VEauK+AKRv+LV9MX5uipxlwaOVQ5f&amp;lt; at &amp;gt;public.gmane.org
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/
&lt;/pre&gt;</description>
    <dc:creator>john skaller</dc:creator>
    <dc:date>2012-05-20T10:58:18</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.lang.felix.general/2918">
    <title>Objects in Felix: Value extensions</title>
    <link>http://permalink.gmane.org/gmane.comp.lang.felix.general/2918</link>
    <description>&lt;pre&gt;So here's object lambdas:

//////////
val x = (a=1, b=2, c="m");
val y = (c=9.9, s="Hello");

typedef X = (a:int, b:int, c:string);
typedef Y = (c:double, s:string);
typedef XYZ = extend X, Y with (k:string) end;

var xyz:XYZ = extend x,y with (k="world") end;

println$ xyz.a, xyz.b, xyz.c, xyz.s, xyz.k;
println$ "Felix Rocks";

var a = object (x:int) = { omethod fun getx()=&amp;gt;x; };
println$ (a 1).getx();
var b = a 2;
println$ b.getx();

var d = (object () = { omethod fun getit() =&amp;gt; "it"; })();
println$ d.getit();
////////////

The "no argument" object is a bit messy, you have to use () 
for the argument, and then apply the lambda to () to instantiate it
(remember, we're declaring a function so we have to apply it
to get a record out of it).

I also don't like needing to say

d.getit()

i.e. to have to put the () there, this works too:

#(d.getit)

and of course

getit d ()

.Of couse ..


fun ff (var x:int) = { 
  return (getx =  x); 
};
println$ (ff 1).getx;

but that's not getting x, it is x :)

--
john skaller
skaller-Rn4VEauK+AKRv+LV9MX5uipxlwaOVQ5f&amp;lt; at &amp;gt;public.gmane.org
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/
&lt;/pre&gt;</description>
    <dc:creator>john skaller</dc:creator>
    <dc:date>2012-05-20T09:05:00</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.lang.felix.general/2917">
    <title>Re: [felix] Re: Objects in Felix</title>
    <link>http://permalink.gmane.org/gmane.comp.lang.felix.general/2917</link>
    <description>&lt;pre&gt;
On 20/05/2012, at 12:16 PM, Raoul Duke wrote:


I guess it depends on the base language: Racket and Clojure are
both Lisp/Scheme dialects, right?

--
john skaller
skaller-Rn4VEauK+AKRv+LV9MX5uipxlwaOVQ5f&amp;lt; at &amp;gt;public.gmane.org
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/
&lt;/pre&gt;</description>
    <dc:creator>john skaller</dc:creator>
    <dc:date>2012-05-20T06:44:32</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.lang.felix.general/2916">
    <title>Re: [felix] Re: Objects in Felix</title>
    <link>http://permalink.gmane.org/gmane.comp.lang.felix.general/2916</link>
    <description>&lt;pre&gt;On Sat, May 19, 2012 at 12:32 AM, john skaller
&amp;lt;skaller-Rn4VEauK+AKRv+LV9MX5uipxlwaOVQ5f&amp;lt; at &amp;gt;public.gmane.org&amp;gt; wrote:

while i sorta agree, there are things like Typed Racket and Typed
Clojure which seem to have gone from dynamic to static and sorta
succeeded?

------------------------------------------------------------------------------
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/
&lt;/pre&gt;</description>
    <dc:creator>Raoul Duke</dc:creator>
    <dc:date>2012-05-20T02:16:37</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.lang.felix.general/2915">
    <title>Objects in Felix: Value extensions</title>
    <link>http://permalink.gmane.org/gmane.comp.lang.felix.general/2915</link>
    <description>&lt;pre&gt;
On 19/05/2012, at 8:27 PM, john skaller wrote:



Ok, so I now think: the first stage in making the Java like syntax
for objects with extensions is anonymous objects:

var o = object (arguments) implements X = {
omethod ...
omethod ...
};


Note that the "implements X" has now been made optional.
If you give it, the compiler can type check it, otherwise the
type is deduced (since it is just a function!).

It's not clear how useful the (arguments) are to an anonymous object,
since you would have to apply it (since its a function) just as you would
for a lambda (anonymous function).

So once we have anonymous objects we can immediate use the

extend x, y, z with (object (arguments) = { 
omethod ...
}) (args) end

syntax .. as a special case when there's no arguments

extend x, y, z with object  {...} end

and thence it's pretty clear:

object derived (arguments) extends x,y,z {
omethod ...
}

is just sugar for the alternate value extension syntax + anonymous objects,
and we're back to something that looks like Java .. except instead of classes
we have objects.

It's not entirely clear this is right because the objects being extended are
just that: they're current values of variables NOT functions, whereas the extension
is actually a function.

Instead, we probably want functions, so:

object derived (arguments) extends X(args), Y(args), Z(args) { ... }

where the args to the X, Y, Z are whatever you want, usually coming from
the arguments to derived. The implementation would then nest

var x = X(args); var y= Y(args); var z=(args);
...

and return the record given by

extend x,y,z with (meth1=meth1, .... )

So this looks like the plan at the moment, though a spider may
jump up and bite me in the bum whilst implementing it..
It can be done in Scheme alone (in the grammar) I think but
I'm not a very good Scheme programmer.

Anyone know any Scheme gurus?

--
john skaller
skaller-Rn4VEauK+AKRv+LV9MX5uipxlwaOVQ5f&amp;lt; at &amp;gt;public.gmane.org
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/
&lt;/pre&gt;</description>
    <dc:creator>john skaller</dc:creator>
    <dc:date>2012-05-19T23:46:30</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.lang.felix.general/2914">
    <title>Amusing facts</title>
    <link>http://permalink.gmane.org/gmane.comp.lang.felix.general/2914</link>
    <description>&lt;pre&gt;Just thought to throw some info in here for no reason.

The way Felix implements closures is non-obvious and not efficient
for a subtle reason. When you do this:

fun f(x:int)=&amp;gt;x;
var g = f;
println$ g1;

Felix create an object of C++ class f on the heap, and stores a pointer
to it in variable g. It has a method 

int f::apply(int x) { return x; }

so when you do the println, Felix calls

g-&amp;gt;apply(1)

right? 

Wrong. Felix calls this:

g-&amp;gt;clone()-&amp;gt;apply(1)

Here clone() says:

return new f(*this);

which creates a self-copy on the heap using the copy constructor,
and returns a pointer to this new object.

This ensures that we always have a virgin function when we call the apply method.

The question is why bother? After all, unlike procedures, functions are invoked immediately
calling the apply method, which pushes the return value on the stack. The only advantage
of the clone() call is that Felix values that didn't get initialised explicitly retain their C++
default constructor values, rather than the last value that happened to be assigned to them.
Right?

WRONG. (You knew that was coming, eh?)

In the example above, there's no reason to clone() the function. 
Well, what about recursive functions? Wouldn't it be bad if a recursion
got a dirty, half initialised object?

fun f(x:int) =&amp;gt; if x == 1 then 1 else x * f (x-1) endif;

Well .. no. You see, this is implemented by calling 

x * (new (stuff) f)-&amp;gt;apply(x-1)

so it created a new object, because the call to f here is a direct call, so the 
closure object (new thing) is created "on the fly". So we actually get a stack
of closures, no problem.

And you see, that's the key to the problem. Read again "direct call".
Now suppose it is an *indirect call*:

fun f(x:int) =&amp;gt; if x == 1 then 1 else x * g (x-1) endif;
var g = f;

Now, you can see that f is calling g, but an f object is stored in g.
So half way through executing the f stored in g, g is reused.
In this case probably little harm, but a more complex function ..
well the local variables would be destroyed (remember, the
return address goes on the machine stack so that's safe).

So that's why the object is cloned: to ensure each invocation uses
a fresh "stack frame".

So, what's a generator? 

Answer: its a function where

clone() { return this; }

i.e. the frame isn't cloned, by a trivial hack to the generated code.
So the state is preserved between calls.


 
--
john skaller
skaller-Rn4VEauK+AKRv+LV9MX5uipxlwaOVQ5f&amp;lt; at &amp;gt;public.gmane.org
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/
&lt;/pre&gt;</description>
    <dc:creator>john skaller</dc:creator>
    <dc:date>2012-05-19T12:41:05</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.lang.felix.general/2913">
    <title>Re: Objects in Felix: Value extensions</title>
    <link>http://permalink.gmane.org/gmane.comp.lang.felix.general/2913</link>
    <description>&lt;pre&gt;A more complete example:

//////
var x = (a=1, b=2, c="m");
var y = (c=9.9, s="Hello");

typedef X = (a:int, b:int, c:string);
typedef Y = (c:double, s:string);
typedef XYZ = extend X, Y with (k:string) end;

var xyz:XYZ = extend x,y with (k="world") end;

println$ xyz.a, xyz.b, xyz.c, xyz.s, xyz.k;
println$ "Felix Rocks";
/////

showing displacement of field c from x, and also the mirror image
type syntax.

of course those X,Y,Z types are also expressible as:

interface X  { a:int; b:int; c:string; }
interface Y { c:double; s:string; }
interface XYZ extends X,U { k:string; }

which looks more Java like but means exactly the same thing.

However the value extension shows that the "OO" system here
is prototype object based rather than class based.

BTW: here's the generated code for the merger:

      PTF x = _art58752(1, 2, ::std::string("m")); //assign
      PTF y = _art58754(9.9, ::std::string("Hello")); //assign
      PTF xyz = _art58755(PTF x.a, PTF x.b, PTF y.c, _art58756(::std::string("world")).k, PTF y.s); //assign

Not very efficient. Unchanged by making x,y vals. The compiler isn't so good at
tracking field values (it does some work tracking tuple components).

[PTF means "pointer to thread frame, expands to ptf-&amp;gt; where ptf is a pointer to the
global storage object called a "thread_frame"]


--
john skaller
skaller-Rn4VEauK+AKRv+LV9MX5uipxlwaOVQ5f&amp;lt; at &amp;gt;public.gmane.org
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/
&lt;/pre&gt;</description>
    <dc:creator>john skaller</dc:creator>
    <dc:date>2012-05-19T10:27:18</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.lang.felix.general/2912">
    <title>Re: Objects in Felix: Value extensions</title>
    <link>http://permalink.gmane.org/gmane.comp.lang.felix.general/2912</link>
    <description>&lt;pre&gt;
On 19/05/2012, at 7:53 PM, john skaller wrote:



It looks a lot more impressive if I show you that it actually works .. :)

(1, 2, 9.9, Hello, world)


--
john skaller
skaller-Rn4VEauK+AKRv+LV9MX5uipxlwaOVQ5f&amp;lt; at &amp;gt;public.gmane.org
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/
&lt;/pre&gt;</description>
    <dc:creator>john skaller</dc:creator>
    <dc:date>2012-05-19T10:04:16</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.lang.felix.general/2911">
    <title>Objects in Felix: Value extensions</title>
    <link>http://permalink.gmane.org/gmane.comp.lang.felix.general/2911</link>
    <description>&lt;pre&gt;I've now implemented value extensions. The syntax is temporary
just to get stuff working.

/////
var x = (a=1, b=2);
var y = (c=9.9, s="Hello");

var xyz = extend x,y with (k="world") end;

println$ xyz.a, xyz.b, xyz.c, xyz.s, xyz.k;
////


Note syntactic quirkology: x,y means value x, then value y, it doesn't mean
the tuple x,y.

extend v1, v2, ... vn with v end

merges the field of all the records v1 to vn and v together to make a new
record, again throwing out duplicate names so the "last mentioned" is kept.

This same syntax is ALSO a type expression when used in a type context.

Note there's no particular reason for extending a list followed by one special
case .. other than that's what Java and most OO languages do when deriving
something new with multiple "bases".

Now, the main reason for implementing this thing is to make it possible
to somehow make objects like this:

fun makeD (b1: Base1, b2:Base2, var x; int) =&amp;gt;
    extend b1, b2 with (getx= fun getx () =&amp;gt; x) end
;

which is an implementation of D, which extends Base1 and Base2.
I don't have a "object" syntax for that yet -- the first step is to have some
kind of cake, before you can put the icing on.

--
john skaller
skaller-Rn4VEauK+AKRv+LV9MX5uipxlwaOVQ5f&amp;lt; at &amp;gt;public.gmane.org
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/
&lt;/pre&gt;</description>
    <dc:creator>john skaller</dc:creator>
    <dc:date>2012-05-19T09:53:15</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.lang.felix.general/2910">
    <title>Re: [felix] Re:  Objects in Felix</title>
    <link>http://permalink.gmane.org/gmane.comp.lang.felix.general/2910</link>
    <description>&lt;pre&gt;
On 19/05/2012, at 4:44 PM, john skaller wrote:



Ah, I should add some comments on "polymorphism" here, meaning
"like Python or Java or C++ virtual functions".

When you do a record coercion it just forgets some fields.
So lets have a look:

interface Base { p: 1 -&amp;gt; 0; } // aka a procedure
interface Derived extends Base {  q: 1 -&amp;gt; 0; }

object B implements Base { 
  omethod proc p() { println$ "Base"; }
}

object D implements Derived {
  omethod p() { println$ "Derived"; }
  omethod q() { println$ "Something"; }
}

var aD = D();

proc doit (x:Base) { x.p(); }

doit (aD :&amp;gt;&amp;gt; Base);

So, what's this going to do? Since we're slicing back the object
you'd be tempted to think "Hey, there's no virtual functions here,
so it's going to print "Base" which of course SUCKS.

But 10 seconds later you realise that's all wrong.
Of course it prints "Derived". Object D is completely unrelated to Object B.
Stripping the function "q" out of the record has no impact on "p".

Indirection is much more powerful than virtual function polymorphism.
It has two downsides:

* It's expensive compared to virtual functions which typically require
only a single vtable pointer in an object

* It's TOO powerful, so it's hard to reason about.

However its a dang sight better to have this overly powerful and expensive
construction that to get stuck with something FAR worse: dynamic typing.

We'll get to that. Felix was always meant to be dynamically typed.
It is a scripting language after all. However, the way forward I have
chosen is: instead of "Python is dynamically typed lets try (in vain) to
add optional static typing". That's crap. It can't work.

The right way to do it is to do the static typing first. Then provide
flexible but statically typed constructions. The more flexible you make
them the more closely it resembles dynamic typing, but now we have
a range of alternatives.

All statically typed languages have dynamic typing in the form
of passing around, constructing, and parsing strings.

--
john skaller
skaller-Rn4VEauK+AKRv+LV9MX5uipxlwaOVQ5f&amp;lt; at &amp;gt;public.gmane.org
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/
&lt;/pre&gt;</description>
    <dc:creator>john skaller</dc:creator>
    <dc:date>2012-05-19T07:32:44</dc:date>
  </item>
  <textinput rdf:about="http://search.gmane.org/?group=$group=gmane.comp.lang.felix.general">
    <title>Search Engine</title>
    <description>Search the mailing list at Gmane</description>
    <name>query</name>
    <link>http://search.gmane.org/?group=$group=gmane.comp.lang.felix.general</link>
  </textinput>
</rdf:RDF>

