<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Kfitzat Ha'derech</title>
	<atom:link href="http://blogs.umass.edu/egottlie/feed/" rel="self" type="application/rss+xml" />
	<link>http://blogs.umass.edu/egottlie</link>
	<description>Programming languages, operating systems, politics, and other religious matters.</description>
	<lastBuildDate>Tue, 19 Jan 2010 03:23:58 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Gopher: the Game</title>
		<link>http://blogs.umass.edu/egottlie/2010/01/18/gopher-the-game/</link>
		<comments>http://blogs.umass.edu/egottlie/2010/01/18/gopher-the-game/#comments</comments>
		<pubDate>Tue, 19 Jan 2010 03:23:58 +0000</pubDate>
		<dc:creator>egottlie</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blogs.umass.edu/egottlie/?p=20</guid>
		<description><![CDATA[&#8220;Gopher&#8221; will be an open-sandbox action game about&#8230; being someone&#8217;s gopher.  You gopher lattes.  You gopher copies.  You gopher pizza and wings. The game follows your career, starting at your first internship in undergrad, in media theory.  You spend years in university, and whenever you try to get an internship or co-op you end up [...]]]></description>
			<content:encoded><![CDATA[<p>&#8220;Gopher&#8221; will be an open-sandbox action game about&#8230; being someone&#8217;s gopher.  You gopher lattes.  You gopher copies.  You gopher pizza and wings.</p>
<p>The game follows your career, starting at your first internship in undergrad, in media theory.  You spend years in university, and whenever you try to get an internship or co-op you end up at a large media corporation with a remarkable resemblance to Fox News.</p>
<p>You parkour your way through a wide-open world to get the random stuff your boss wants.  As the game goes on, you acquire skills like waving a press pass, stealing vehicles, causing a spectacle, hand-to-hand combat, and even short-range teleportation.  Your ultimate goal&#8230; TO TAKE OVER THE COMPANY!!!!</p>
<p>Jump rooftops, misdirect crowds, infiltrate secret locations, ride subway cars on the roofs&#8230; and become the one, the only, THE ULTIMATE GOPHER!  And at last the CEO of a major media corporation.</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.umass.edu/egottlie/2010/01/18/gopher-the-game/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Escher Idea for Implementation</title>
		<link>http://blogs.umass.edu/egottlie/2009/07/08/escher-idea-for-implementation/</link>
		<comments>http://blogs.umass.edu/egottlie/2009/07/08/escher-idea-for-implementation/#comments</comments>
		<pubDate>Wed, 08 Jul 2009 20:17:45 +0000</pubDate>
		<dc:creator>egottlie</dc:creator>
				<category><![CDATA[escher]]></category>
		<category><![CDATA[directfb]]></category>
		<category><![CDATA[language]]></category>
		<category><![CDATA[opengl]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://blogs.umass.edu/egottlie/?p=16</guid>
		<description><![CDATA[Use DirectFB for the underlying implementation. It works very quickly on a desktop and Voodoo lets it work transparently over a network. On the other hand, does it have any kind of OpenGL support? Vector graphics as used in Escher are much easier to convert into OpenGL than 2D framebuffer operations. EDIT: Cairo looks much [...]]]></description>
			<content:encoded><![CDATA[<p>Use <a href="http://directfb.org/">DirectFB</a> for the underlying implementation.  It works very quickly on a desktop and Voodoo lets it work transparently over a network.</p>
<p>On the other hand, does it have any kind of OpenGL support?  Vector graphics as used in Escher are much easier to convert into OpenGL than 2D framebuffer operations.</p>
<p>EDIT: Cairo looks much better and supports the rendering model I&#8217;d like natively.  However, it appears to have limited support for OpenGL, but let&#8217;s see what&#8217;s what.</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.umass.edu/egottlie/2009/07/08/escher-idea-for-implementation/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>More Stuff on Escher</title>
		<link>http://blogs.umass.edu/egottlie/2009/06/30/more-stuff-on-escher/</link>
		<comments>http://blogs.umass.edu/egottlie/2009/06/30/more-stuff-on-escher/#comments</comments>
		<pubDate>Wed, 01 Jul 2009 04:27:02 +0000</pubDate>
		<dc:creator>egottlie</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blogs.umass.edu/egottlie/?p=14</guid>
		<description><![CDATA[OK, so the whole notion of having separate textures and pictures is stupid. What I actually want to do is render to surfaces, yielding surfaces with things on them. Paths can be stroked, filled, or textured to yield pictures. Pictures can be rendered to yield a surface. Now, Escher&#8217;s conception of a surface should not [...]]]></description>
			<content:encoded><![CDATA[<p>OK, so the whole notion of having separate textures and pictures is stupid.  What I actually want to do is render to surfaces, yielding surfaces with things on them.  Paths can be stroked, filled, or textured to yield pictures.  Pictures can be rendered to yield a surface.  Now, Escher&#8217;s conception of a surface should not just be a big bitmap or a printed page.  It should be a surface with a clipping path and a transformation matrix.</p>
<p>In fact, one should render to a surface yielding another surface (this time with the actual backing bitmap or page changed, duh).  This makes the type of the render method render: (window,surface) -&gt; surface.  Yay.  That actually makes the whole conception of how it works to place windows much easier.  The owner window has some spot it wants to render the child window into represented by a clipping path and a transformation matrix.  It can take the surface it was given to render into and apply those to get a new surface value that it passes to the child window.  Child window renders to mutate the surface and returns it.  Wallah!</p>
<p>So, operators with surfaces for rendering things&#8230; </p>
<p>subsurface: (surface,matrix,clip) -&gt; surface<br />
render: (picture,surface) -&gt; surface</p>
<p>Well what do those look like in syntactic terms?  I already have a &#8220;compose&#8221; operator that puts paths and pictures on top of one another.</p>
<p>x -&gt; y means x rendered on top of y, or y rendered followed by x.  I can easily just add the capability to take a surface as the second operand and do rendering that way.  Oh, and x -&gt; y where both x and y are surfaces blits x onto y.</p>
<p>x:(y,z) means to yield the surface x subject to the transformation matrix z and the clipping path y.  Looks good enough.</p>
<p>Add a library function for inverting a matrix.  Actually, for a two-dimensional world would a quaternion (3 floats), a scaling vector (2 floats), and a translation vector (2 floats) be less floats than a 3&#215;3 matrix?  Well yes, but then I can&#8217;t compose operations by matrix multiplication.  Well I do have first-class functions, so what the hell do I need composition by matrix multiplication for?  Oh, right, speed.  It&#8217;s faster to compose 2 functions into a new function, but slower to actually apply the composed function than to vector*matrix multiply.  Well, actually the matrix approach gets cheaper with the number of operations composed.</p>
<p>Anyway, my standard library ought to include functions for making rotation matrices, scaling matrices, translation matrices, and inverting matrices.  This will help in dispatching input events that specify a point inwindow: just check clipping paths for a sub-window it falls in and then multiply the input by the inverse of the transformation matrix for that sub-window.</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.umass.edu/egottlie/2009/06/30/more-stuff-on-escher/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Notes on &#8220;Escher&#8221;, a User-Interface Language</title>
		<link>http://blogs.umass.edu/egottlie/2009/06/21/notes-on-escher-a-user-interface-language/</link>
		<comments>http://blogs.umass.edu/egottlie/2009/06/21/notes-on-escher-a-user-interface-language/#comments</comments>
		<pubDate>Sun, 21 Jun 2009 21:24:21 +0000</pubDate>
		<dc:creator>egottlie</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[escher]]></category>
		<category><![CDATA[graphics]]></category>
		<category><![CDATA[language]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[user interface]]></category>

		<guid isPermaLink="false">http://blogs.umass.edu/egottlie/?p=11</guid>
		<description><![CDATA[Notes written on a client-side language for drawing and running user interfaces called Escher.  Draws heritage from Smalltalk, Erlang, and Functional Postscript.]]></description>
			<content:encoded><![CDATA[<p>Start with high-level decisions and any obvious implementation details.</p>
<p>Base it on the Actor model.  Every window is an Actor in the software, though messages must arrive in the order sent.  Sending a message looks and acts like a function call (ie: it can expect a result and works synchronously) by default, but an option will exist to send an asynchronous message.  In order to make this still behave like a function call, the result of an asynchronous message send is set to a future of the result.  Attempting to evaluate the future waits for the reply message containing the result to arrive and returns that result when it does.  All messages consist of a name and parameters, and the ability to send them to any other window is statically-typed.</p>
<p>Each &#8220;frame&#8221; it receives messages as events, which are handled using event-handling constructs.  A special message message called render must have a handler that returns renderable data for putting on screen, and this message will go to the window every single frame.  Each event handler is basically a function/procedure, and in each such function a window can also choose to send messages (including the one triggering the event) to either its master or to any window to which it has a valid reference.  A window&#8217;s &#8220;master&#8221; is simply an abstract source and destination for messages (implementations can include IPC or sockets), every window must have a master.  </p>
<p>Base the rendering primitives on Postcript, PDF, and/or Quartz, but with the addition of a picture subtype called a surface that represents a fully-drawn picture in memory and can be attached via texture coordinates to a path to texture it.  Add various sorts of 2D video processing or post-processing techniques as functions from pictures to pictures.  Remember to include geometrical functions for creating and transforming the points in a path.  Possibly add pixels or point particles as a type of picture so as to support effects that make liberal use of putpixel()-type ideas.</p>
<p>Garbage-collect memory, even though most allocations should be static or assigned to the state variables of a window.</p>
<p>Data types: real numbers, natural numbers, points, matrices, arrays/lists, structures, unicode strings, paths, pictures (including surfaces), windows.  Composite data type and modular unit: window.  Should there be first-class functions?  Local type inference?  Representing messages as functions/lambdas would certainly be useful.</p>
<p>Let windows be defined like classes, including with generics &#8212; they have instance variables that serve as their internal state and methods corresponding (by name) to the messages they can handle.  Window types require a constructor which takes not only an implicit this parameter but an implicit owner or master parameter referring to the message destination that runs the real computation to which this window interfaces.  Windows types can also inherit from a parent type.  One window type in a program must be called Main, and this window type is the one that the runtime system creates an instance of as the root window.</p>
<p>Every window theoretically runs in a separate lightweight process (ie: shared nothing), but the actual management of concurrency is left up to the runtime.  Every method is by default synchronized and locks a mutex guarding all the internal state of the window on entry, releasing it on exit.  As an optimization technique, methods that don&#8217;t access any of the internal state of the window may run without locking.</p>
<p>A window can access its own instance variables and those of any instance variable whose type is window.  Every window has an implicit owner instance variable of the special type socket (or similar name with the same meaning).</p>
<p>Implementation details: do the I/O with SDL and OpenGL where available.  For speed, don&#8217;t interpret programs in this language, JIT compile them using LLVM.</p>
<p>This owes its ideas about windows and messaging to Smalltalk, its rendering ideas to Functional Postscript, and its concurrency ideas to Erlang.</p>
<p>Need to keep nitty-gritty details more secretive to have material left over for senior thesis/Capstone project <img src='http://blogs.umass.edu/egottlie/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> .</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.umass.edu/egottlie/2009/06/21/notes-on-escher-a-user-interface-language/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Dumb Vampire Kids</title>
		<link>http://blogs.umass.edu/egottlie/2009/06/02/dumb-vampire-kids/</link>
		<comments>http://blogs.umass.edu/egottlie/2009/06/02/dumb-vampire-kids/#comments</comments>
		<pubDate>Tue, 02 Jun 2009 06:15:14 +0000</pubDate>
		<dc:creator>egottlie</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[fads]]></category>
		<category><![CDATA[humor]]></category>
		<category><![CDATA[joke]]></category>
		<category><![CDATA[laugh]]></category>
		<category><![CDATA[notreal]]></category>
		<category><![CDATA[popculture]]></category>
		<category><![CDATA[satire]]></category>
		<category><![CDATA[stupids]]></category>
		<category><![CDATA[tweens]]></category>
		<category><![CDATA[undead]]></category>
		<category><![CDATA[unholy]]></category>
		<category><![CDATA[vampires]]></category>

		<guid isPermaLink="false">http://blogs.umass.edu/egottlie/?p=8</guid>
		<description><![CDATA[Tonight we had a bit of a conversation over whether stupid Anne Rice-style vampire romances such as &#8220;Twicraplight&#8221; came from something inherent in the trope of vampires in general or had grown as a phenomenon. Eventually, everyone came around to Lauren&#8217;s point of view that vampires tapped into the fantasies of threatening lovers and into [...]]]></description>
			<content:encoded><![CDATA[<p>Tonight we had a bit of a conversation over whether stupid Anne Rice-style vampire romances such as &#8220;Twi<i>crap</i>light&#8221; came from something inherent in the trope of vampires in general or had grown as a phenomenon.  Eventually, everyone came around to Lauren&#8217;s point of view that vampires tapped into the fantasies of threatening lovers and into rape fantasies, which apparently have existed since &#8220;the dawn of time&#8221; (those readers who fantasize about the most horrific act one human being can inflict on another without special training <i>can leave now</i>).</p>
<p>Ah, but I&#8217;ve come to realize that they do, in fact, come from a source: vampires.  If they actually existed, what better way to lure in victims who won&#8217;t fight than to portray themselves as the ultimate in forbidden lovers?  Convince millions of dumb tween girls and budding tween BDSM guys that they can find the ultimate good time for their pure, virginal selves with an undead, creature-of-the-night abomination against God, and the kids will line up to die horribly!  Only selling heroin to addicts gets easier than this!</p>
<p>So I don&#8217;t care if they work according to &#8220;Let the Right One In&#8221; rules, traditional &#8220;Nosferatu&#8221;/&#8221;Dracula&#8221; rules, &#8220;Carpe Jugulum&#8221; rules, or &#8220;Buffy the Vampire Slayer&#8221; rules.  They all must die, or at the very least we must reduce the threat of annoying wannabe vampires to our species.</p>
<p>I have the answer!  Vampire romances work by portraying the unholy as forbidden lovers whose very presence can bring about a blissful serenity and whose touch can ignite the blood.  See, those descriptions sound good and I&#8217;ve just lifted them from other sources!  Of course, the emphasis here lays on <i>forbidden</i>: even the dumbest tweens tend to moderate themselves in the unhealthy pleasures that come commonly and mundanely.  Try to find a large, nationwide clique of rebellious little moron who, for example, get high by overdosing on caffeine or through erotic autoasphixiation (seriously, only Fox News thinks real numbers of people do that).</p>
<p>Thus, by releasing a major motion picture in which every teenage girl gets given to a vampire at her sixteenth birthday for the satiation of her perverse sexual lust and his sheer, predatory thirst for blood only to find him treating her with contempt and screwing other women in nightclub bathrooms, we can finally convince tween girls that vampires suck and all must die.  Honestly, I think once that happens the young boys will follow, as most guys just don&#8217;t have rape fantasies.</p>
<p>Presto chango, vampire fad problem solved and possible threat to large segments of the human race (let&#8217;s call it &#8220;blood-terrorism&#8221; to get government defense funding) averted!</p>
<p>In other news, I&#8217;ve begun experimenting to see if I can build a Naive Bayesian Classifier that will, by content alone, tell the difference between a reliable news report and some bull that someone just made up on the internet.</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.umass.edu/egottlie/2009/06/02/dumb-vampire-kids/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>This is why we can&#8217;t have nice things&#8230; like peace.</title>
		<link>http://blogs.umass.edu/egottlie/2009/05/07/this-is-why-we-cant-have-nice-things-like-peace/</link>
		<comments>http://blogs.umass.edu/egottlie/2009/05/07/this-is-why-we-cant-have-nice-things-like-peace/#comments</comments>
		<pubDate>Thu, 07 May 2009 21:33:15 +0000</pubDate>
		<dc:creator>egottlie</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[goddamnit]]></category>
		<category><![CDATA[israel]]></category>
		<category><![CDATA[middle_east]]></category>
		<category><![CDATA[palestine]]></category>

		<guid isPermaLink="false">http://blogs.umass.edu/egottlie/?p=5</guid>
		<description><![CDATA[Mere days after its leader-in-exile Khaled Meshaal told America, the New York Times, and the world that Hamas would cease firing rockets at Israel in order to better &#8220;serve the people&#8217;s interest&#8221; and reevaluate their strategy, Hamas militants fired rockets into Israel. Again. Several people were wounded in Israel and then in Gaza when Israel [...]]]></description>
			<content:encoded><![CDATA[<p>Mere days after its leader-in-exile <a href="http://www.nytimes.com/2009/05/05/world/middleeast/05meshal.html">Khaled Meshaal</a> told America, the New York Times, and the world that Hamas would cease firing rockets at Israel in order to better &#8220;serve the people&#8217;s interest&#8221; and reevaluate their strategy, <a href="http://www.nytimes.com/2009/05/07/world/middleeast/07briefs-gaza.html?_r=1&amp;ref=world">Hamas militants fired rockets into Israel</a>.  <b>Again</b>.  Several people were wounded in Israel and then in Gaza when Israel returned fire.</p>
<p>And people want Israel to make peace with this: an organization that will not even obey its own leader if he gives that most heinous, sinful, and <i>harum</i> (Arabic for &#8220;forbidden&#8221;) of orders, to stop firing.  It really does appear that people don&#8217;t understand the Palestinian situation.  The Palestinian situation is that if a Palestinian of importance tries to moderate his approach or even simply cease violent action temporarily for strategic purposes, he risks disobedience at least and murder at worst.  Even back in 1967, Palestinians told Israel that they could not accept a state in the contiguous, then-unsettled West Bank and Gaza Strip because Yaser Arafat would kill them.  Thus, violence has become <a href="http://haaretz.com/hasen/spages/775946.html">the Palestinian disease</a>, a overriding all other approaches to life for its own sake.</p>
<p>This is why Jews and Israelis tell a joke about ceasefires.  We know that when the UN or someone else presses us into a ceasefire with our foes, it means that we cease, and they fire.</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.umass.edu/egottlie/2009/05/07/this-is-why-we-cant-have-nice-things-like-peace/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>My Complete Lack of a Solution to the Covariant Assignment Problem</title>
		<link>http://blogs.umass.edu/egottlie/2008/12/03/my-complete-lack-of-a-solution-to-the-covariant-assignment-problem/</link>
		<comments>http://blogs.umass.edu/egottlie/2008/12/03/my-complete-lack-of-a-solution-to-the-covariant-assignment-problem/#comments</comments>
		<pubDate>Wed, 03 Dec 2008 18:39:14 +0000</pubDate>
		<dc:creator>egottlie</dc:creator>
				<category><![CDATA[Deca]]></category>

		<guid isPermaLink="false">http://blogs.umass.edu/egottlie/2008/12/03/my-complete-lack-of-a-solution-to-the-covariant-assignment-problem/</guid>
		<description><![CDATA[So I eventually figured out that my problem from the last post reduced to assigning values to statically-allocated variables whose declared types were covariant to the type of the values in such a way that the subtype and supertype require different amounts of memory to store.  Most languages, at this point, just give up and [...]]]></description>
			<content:encoded><![CDATA[<p>So I eventually figured out that my problem from the last post reduced to assigning values to statically-allocated variables whose declared types were covariant to the type of the values in such a way that the subtype and supertype require different amounts of memory to store.  Most languages, at this point, just give up and make variables whose declared type is a class actually a <em>reference</em> to an instance of that class.</p>
<p>Well not me, nosiree!  Instead of completely destroying programmers&#8217; ability to statically allocate lexical variables of object type (which includes closures, in theory, since in theory closures and objects are equivalent), I&#8217;m just going to make it illegal to perform covariant assignments or returns.  Deca will still allow assignment from an alias to a subclass to an alias to a superclass, however, and it will also maintain the ability to pass arguments to functions by reference.  Combined, these will allow programmers to create and allocate static lexical variables of object or closure type and pass them freely into any function that accepts the correct superclass or function type, while still requiring programmers to use dynamic allocation or aliases to global, anonymous variables to pass objects and closures of dynamic type up the call chain.</p>
<p>To rationalize this design decision, sometimes a systems-programming language <em>should</em> expose the ugly guts of variable storage, right?</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.umass.edu/egottlie/2008/12/03/my-complete-lack-of-a-solution-to-the-covariant-assignment-problem/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Lambda Signatures as Interfaces or Abstract Superclasses</title>
		<link>http://blogs.umass.edu/egottlie/2008/12/01/lambda-signatures-as-interfaces-or-abstract-superclasses/</link>
		<comments>http://blogs.umass.edu/egottlie/2008/12/01/lambda-signatures-as-interfaces-or-abstract-superclasses/#comments</comments>
		<pubDate>Tue, 02 Dec 2008 04:15:29 +0000</pubDate>
		<dc:creator>egottlie</dc:creator>
				<category><![CDATA[Deca]]></category>

		<guid isPermaLink="false">http://blogs.umass.edu/egottlie/2008/12/01/lambda-signatures-as-interfaces-or-abstract-superclasses/</guid>
		<description><![CDATA[So I&#8217;ve got this great programming language all worked out.  It&#8217;s called Deca, and it&#8217;s the systems-programming language I&#8217;ve always wanted.  It has bloody everything I like: a single-inheritance object system based on generic functions and multimethods, tuples-as-structures-as-arrays-as-objects, lexical scoping with Scheme-style LET statements, exceptions, a parametric module system for generic programming, local type inference [...]]]></description>
			<content:encoded><![CDATA[<p>So I&#8217;ve got this great programming language all worked out.  It&#8217;s called Deca, and it&#8217;s the systems-programming language I&#8217;ve always wanted.  It has bloody everything I like: a single-inheritance object system based on generic functions and multimethods, tuples-as-structures-as-arrays-as-objects, lexical scoping with Scheme-style LET statements, exceptions, a parametric module system for generic programming, local type inference with static typing, even an absolutely-most-definitely-guaranteed-safe alias/reference type that gives me processor-level mutexes for free and enables me to compile the language down to machine code with no runtime library or garbage collection.  Oh, and there&#8217;s an &#8220;unsafe&#8221; dialect for writing modules that need pointers and inline assembly.  Sounds fricking awesome, right?  Why, I should probably go ahead and implement the compiler ASAP so I can claim my world fame, right?  Actually, I still need to design a complete syntax for all this, but I could still write it in S-expressions until I work out a better syntax.</p>
<p>Well no.  Because I want to add first-class functions to this language.  Therein lies the rub, because any function passed around as a first-class value could, and often does, have a closure environment of some sort with it.  However, the signature of the function, which would normally be its whole and entire type in a functional language (Function of x, y, and z returning an a and carrying a closure pointer that may be null&#8230;), cannot possibly be its whole type in Deca, because Deca has to run without (language-supplied) garbage collection and therefore the size of every single data object passed into or out of a function must be known in such a way that the compiler can theoretically (that is, before optimizations like passing arguments in registers) allocate that object on the stack.  As I&#8217;ll explain below, this is a problem.</p>
<p>So far I&#8217;ve been using the idea from D (as in Digital Mars&#8217; D) for compiling closure expressions: create an anonymous class to contain the variables the compiler infers as closed-over by the function definition, with a &#8220;call&#8221; or &#8220;operator()&#8221; method that (other than its closure-object argument, which the compiler automatically passes like a &#8220;this&#8221; pointer despite Deca being a multiple-dispatch language) has an identical signature to the function as the programmer defined it.  Calling an instance of such a class (ie: &#8220;f()&#8221; where f is of a function type) calls the correct (as determined by runtime dispatch) &#8220;operator()&#8221; method with the given arguments and the implicit instance of the closure-object.  To make all this more than mere syntactic sugar for anonymous classes, all &#8220;closure classes&#8221; are direct subtypes (meaning no closure class is a child of another closure class) of an abstract supertype (with no closed-over variables at all) that simply represents an old-fashioned, C-style function pointer with no closures involved.</p>
<p>By now you probably see the problem yourself.  <em>If I have to define the type of an argument to or return value from a function and I define it as a function type, how much space should the compiler allocate on the stack to pass or return such an &#8220;object&#8221;? </em></p>
<p>For arguments I can simply use pass-by-reference, of course.  The compiler allocates space for a pointer, does its type-checking and uses old-fashioned RTTI to determine what the function actually got at runtime.  But I anticipate that programmers (not in the least myself) will actually want to pass a function by value at some point.  Actually, even old C has variadic functions that determine at compile-time how much memory is needed on the stack for their arguments, but I&#8217;m sketching this part out to show how much harder the hard case is in contrast.</p>
<p>What about return values of function types?  Or more generally, what happens when I declare a function as returning an instance of a certain class and then attempt to <em>actually</em> return an instance of one of its subclasses?  How do I avoid resorting to pointer semantics here?  C++ seems to handle it somehow (see the attached C++ source file to test the language&#8217;s behavior), so I guess I should start by disassembling my C++ binary.  If anyone has an idea that doesn&#8217;t involve disassembling a binary file originally written in the Shub-Niggurath of programming languages (I didn&#8217;t wear my Magen David when I did it, so my soul may or may not remain in my body), please feel free to leave it in a comment so I can steal it!</p>
<p>Happy hacking to all!  Here&#8217;s the source of the program I wrote to see how C++ handles this stuff.  It compiles under Linux with g++, and uses weird &#8220;flds/z/cw&#8221;, &#8220;fucompp&#8221;, &#8220;fnstsw&#8221;, &#8220;fistpl&#8221; and &#8220;sahf&#8221; x86 assembly instructions that I&#8217;ve never seen before.  TO THE INTEL BIBLE!</p>
<blockquote><p>class Parent {<br />
public:<br />
virtual int foo(int bar) {<br />
return bar + 1;<br />
}<br />
};</p>
<p>class Child: public Parent {<br />
int quux;<br />
public:<br />
int foo(int bar) {<br />
return bar + quux;<br />
}<br />
Child(int i) {<br />
quux = i;<br />
}<br />
};</p>
<p>Parent baz(float x) {<br />
if(x &lt; 0.0)<br />
return Child((int)x);<br />
else<br />
return Parent();<br />
}</p>
<p>int main(int argc,char** argv) {<br />
return 0;<br />
}</p></blockquote>
<p>Yeah, gorram WordPress doesn&#8217;t let me attach .cpp files.  They don&#8217;t meet its security guidelines <img src='http://blogs.umass.edu/egottlie/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> .</p>
<p>EDIT: It turns out those funny instructions are floating-point instructions.  Made x an integer now to get rid of them.  The code still looks weird, but interpretable.</p>
<p>AGAIN EDIT: It appears the language feature I&#8217;m looking for is called return-type covariance.  So yeah, I need some way to return values of covariant type to my declared return type on the stack.</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.umass.edu/egottlie/2008/12/01/lambda-signatures-as-interfaces-or-abstract-superclasses/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
	</channel>
</rss>

