Archive for the ‘Fantom’ Category

Markdown for Fantom

Sunday, February 5th, 2012

Sunday Funday project for today – Markdown for Fantom:

https://bitbucket.org/afrankvt/markdown

Markdown is a great little plain-text format created by John Gruber that converts nicely to HTML. Fantom’s own Fandoc was heavily inspired by Markdown. We just simplified a few things and added some Fantom conventions in a few places. But I’ve wanted the full Markdown syntax at my disposal for some time now.

Luckily it was a pretty simple project - I was able to essentially take the great Markdownj work as-is and wrap with a native Fantom API. Code is available over at BitBucket and is licensed under the BSD license.

LESS for Fantom

Sunday, January 22nd, 2012

I worked up a Fantom wrapper around LESS this week. Code and docs over on BitBucket:

https://bitbucket.org/afrankvt/less

LESS is a great little “extension” to CSS that adds lots of convenient features like variables, mixins, and nested rules that make developing and managing complex CSS much easier.

The Fantom wrapper adds:

  • An API interface to compile LESS files from a Str input or a File reference
  • A simple command line interface for compiling LESS files to CSS files
  • A BuildTask for integrating LESS into your Fantom build pipeline

Draft Mini Web Framework

Sunday, July 24th, 2011

I’ve posted a project I’ve been working on in my spare time recently:

Draft Mini Web Framework

Draft is a small web framework designed to notch in above WebMod, provide some useful features, while trying to leave as much freedom as possible for your app. Details over on the project site.

Its still a work in progress, but decided it was far enough along to start being useful to anyone who doesn’t mind getting their hands dirty. Hopefully I’ll have it wrapped up here in the next few months, and can be more generally useful to developers looking for a simple and lightweight solution for developing web apps in Fantom.

Sketching Logos

Wednesday, January 5th, 2011

Was flipping thru an old moleskin and found two sketches I made back in Fall 2009.

Fantom logo sketch

First was a little sketch of a potential logo for the Fantom language. For whatever reason, when we changed the name to Fantom, I got this 1920s/Art Deco motif concept in my head (hence the typeface). I’m pretty sure its because of the movie The Shadow, but I keep trying to tell myself thats not the case… Never really had time to come up with a real logo — but this is one I sorta liked.

Axon logo sketch

Second was a logo for the Axon scripting language we designed for our day job at SkyFoundry. Would love to give these both some good Photoshop treatment if I ever find the time.

Blue Collar Languages

Monday, September 27th, 2010

Cay Horstmann wrote an interesting response to Stephen Colebourne’s NBJL post:

Creating a “blue collar” language isn’t something that happens every day.

When done by “blue collar” people who have sketchy knowledge of programming language theory, the result is often problematic. Look at PHP–I trust that I won’t have to elaborate… Or Groovy, many of whose properties (particularly in the MOP) are under-specified and constantly shifting.

Few “white collar” people have an interest in designing a blue-collar language. They give us languages that dazzle us with their brilliance and innovation. After all, that’s what a researcher is rewarded for.

Interestingly he made no mention of Fantom in this context, which means I assume he hasn’t looked at it any detail. That was one of the explicit design goals.

Which makes me wonder - do people pass over Fantom because of the exact same reasons they search for new languages? You want a simpler, more expressive language, with great APIs, that make your life easier 9-5. But you take a look at Fantom, and move right along, since you don’t see buzzwords like monads, or some ground breaking new syntax?

Fantom’s History and Future with JavaScript

Wednesday, June 2nd, 2010

One of Fantom’s primary design goals from day one was portability between the JVM and CLR. Naturally we got to thinking, if we can run on both of the popular VM’s, why not on JavaScript too? That would enable enormous opportunities for code reuse and greatly simplify the huge impedance mismatch of developing backend server code and user interfaces in the browser.

Read the full post at Fantom.org

SkySpark

Monday, April 12th, 2010

The product we have been crafting at SkyFoundry for the past year and a half has officially been christened as SkySpark.

SkySpark

SkySpark is turning out to be an awesome platform for visualizing, analyzing, and managing mountains of data. We’ve updated the website to include some high level technical documentation on the software stack. Its built 100% in Fantom - including all the client-side browser code using the Fantom JavaScript compiler.

This software has really validated the years of effort we’ve put into making Fantom a first-class language. I don’t think we’d have been able to build anything even close without it. I’m excited to show off more as we move towards the official release.

Fantom AST Viewer

Friday, January 22nd, 2010

Finally got around to throwing the code to my Fantom AST Viewer online. You can check it out over on bitbucket:

http://bitbucket.org/afrankvt/fanast/

Its pretty crude, but works, and should be pretty easy to fix or modify to suite your needs.

Screenshot

Static Typing

Sunday, July 26th, 2009

I’m not big on comparing the merits of different languages. Every language I’ve used serves a good purpose for some task. So I generally pick the best language for the task at hand.

In general, though, I always tend to prefer static languages for anything but a small or quick and dirty project. Especially when its a code base I intend to maintain for some time.

I just spent the weekend refactoring Fan’s JavaScript compiler to change how I model Fan fields in JavaScript. The way I had previously done it looked like this:

// Fan
class Foo { Int x := 5 }

// JavaScript
Foo.prototype.x$get = function() { return this.x; }
Foo.prototype.x$set = function(val) { this.x = val; }
Foo.prototype.x = 5;

Which isn’t great, but didn’t really have alot of options. But it seemed nice enough. It grouped the accessors and storage neatly together. And in most cases, since I can access the storage directly, the code overall was fairly clean.

Unfortunately that model made it very difficult to make certain use cases of fields and methods work (like overriding a const field with a method). So I changed the JavaScript to look like this:

// Fan
class Foo { Int x := 5 }

// JavaScript
Foo.prototype.x = function() { return this.m_x; }
Foo.prototype.x$ = function(val) { this.m_x = val; }
Foo.prototype.m_x = 5;

That change would have been a bit painful in any language, since there was just alot of code to update (the sys library and all the native implementations are written directly in JavaScript).

However, since JavaScript does not have static type checking, I pretty much had to tackle errors one-by-one using the test suite and Fresco (the web UI I’m developing at SkyFoundry).

This is probably the biggest reason I prefer static languages. When you have to make sweeping changes on a large code base, you simply can’t verify your changes 100% in any language. But a compiler with static type checking can help you tremendously. Especially for code that is difficult to unit test, like UIs.

Javascript Bitshift Performance

Tuesday, June 16th, 2009

While working on 64-bit integer support in Javascript for Fan, I ran across a blurb about bit shift performance of Numbers. The basic gist was, since Javascript has to convert the number to an integer, perform the op, then convert back, multiplying or dividing by a power of two should be as fast, or faster. On the surface that might make sense, but I wanted to see for myself, so I hacked up a very naive test case:

var x = 0xffff;

var s = new Date().getTime();
for (var i=0; i<100000; i++) x = x >> 2;
var e = new Date().getTime();
var res1 = (e-s);

s = new Date().getTime();
for (var i=0; i<100000; i++) x = x / 4;
e = new Date().getTime();
var res2 = (e-s); 

alert(">> " + res1 + "ms\n" + "/  " + res2 + "ms");

Very unscientific results:

Browser               >> 2    / 4
--------------------  ------  -------
Chrome 2.0.172.31     2-3ms   4-7ms
Firefox 3.0.11 (win)  11ms    15-16ms
Safari 3.1 (win)      15ms    15ms
IE8                   63ms    62-78ms
Opera 9.64 (win)      46ms    63ms

Interesting to see the different performance b/w browsers, but also seems clear, overall, the bit-shift operators perform slightly better even with the box/unbox hit.