Category Archives: Cyberspace

Source code in the wild

This is a big day for me only because it is the first public release of the Skila source code, not because the code is so mature you can only read it in awe. Maybe such day will come too, but until then a fair warning — it is more of a backup of the Skila project, not a proper “release”. Yet, somehow test cases can be executed and the computation is correct, so at least something works.

If you are curious and brave — you are welcome to give it a try.

Advertisement
Tagged

When IntelliSense slows you down…

I use mostly Visual Studio 2010 to develop Skila but one thing that drives me crazy is the performance of IntelliSense with remote files. It does not work slower — it crawls. I don’t know why it is so hard to read the file and allow to edit it, but since even scrolling through the file is lagging I was happy to notice Xamarin Studio developers figured it out. It is not as mature as VS, it lacks reliable debugger, but when it comes to initial implementing ideas I use XS now. The acronym is much better for sure.

Xamarin Studio is available for Mac and Windows, for Linux we have MonoDevelop. The difference is (quote) — “Xamarin Studio (…) is a bundle of MonoDevelop along with Xamarin iOS/Android plugins and branding”.

Tagged , , ,

From Nand to Tetris

A week ago the first part of course “From Nand to Tetris” by Noam Nisan and Shimon Schocken has started. I am in the middle of solving first week (01) assignments and the more I write the more fun I have. Check it out yourself, it looks interesting.

Tagged , , , , ,

What is easy — generics with nullable types not for sure

For a week I have been removing features from Skila (so far just two) and postponing some nice things for later implementation — I still want Skila to look at least nicely. Ironically that easy subset is not that easy to grasp, currently I hit hard on nullable types. So far I could see three camps:

  • C# — implicit null-check with null values (there are no referential non-nullable types though),
  • Kotlin camp — explicit null-check with null values,
  • Swift camp — as Kotlin but with wrapper class “Option” instead of null.

Take my words with grain of salt because I don’t know Kotlin or Swift.

Using “null” is not the same as having “Option”, the second can be wrapped as many times as you like when in case of the former you cannot wrap “null” into “null” — it is a value, not a wrapper.

On the other hand all checks designed for nullable type can be applied to non-nullable type, this is not true with optional types. For example one can blindly execute “x != null” check in Kotlin, while the analogous code in Swift requires “x” to be really an “Option”.

Worse, both Kotlin and Swift approaches bring problems to Skila, for example — how do you initialize objects of generic type? If I choose Kotlin solution how does inheritance tree look like for nullable types? And even if I choose Kotlin approach indeed I know that “Option” type will have to be added as well, so maybe add it right from the beginning… and so on and on.

Just to increase my confusion I found out some inconsistency in Kotlin:

open class Foo {
  fun foo() : Int {
    return 0;
  }
}

fun test<T : Foo?>(x : T) : Int {
  return x.foo() // (*)
}

fun main(args : Array<String>) {
  println(test<Foo?>(null))
} 

Compiler should demand “x!!.foo()” in line marked with “(*)”, but the code above compiles without any errors. And it worries me for Skila — those two ideas (generics with nullable/optional types) are not easy and it is hard to foresee (at least for me) all the problems with writing generic classes in practice.

If you are curious you can play online with both languages — playground for Swift and for Kotlin.

Tagged , , , , , , ,

I need Skila even more badly

Boy, I have been busy! Unfortunately nothing related to Skila or NLT. I have “little” project going and I fell into a cycle of adding just the last feature and having five more ideas. Now I am at the point that I have tons of good ideas, the project looks really interesting and useful (educational area — I am not giving the address away yet, because I didn’t figure out the good name for it), I am enjoying it tremendously and I need server side language very badly.

PHP, Python, JS (with Node.JS), C# or maybe C++ — oh man, not those. I’ve been there — this one is not compiled, that one is cryptic, other closed but open-source. No, no, no. I can write programs in those languages for somebody else, but why hurt myself? Apple’s Swift could come to the rescue, but I don’t live in Apple ecosystem. Skila is supposed to be my solution but Skila is not ready.

Seriously, I am desperate. I am bored to death with limitations of nowadays languages, I want to enjoy writing code (after all it will take a lot of time, my leisure time).

And so I am evaluating another possibility — killing Skila! Yes, that’s correct. I am thinking that I made a mistake with the attitude to design — creating perfect language, with perfect features. That is exactly what is stopping me. Perfect is complex, perfect is hard, and I don’t have time for that. I need Skila for yesterday so my other project could grow.

I need imperfect language, simplified so I could cover at least server side of my project, and then client side. This is not awfully far for what I had in mind initially, but I drop performance from my goals. There is also a small advantage for me — I could make a compiler faster, design language faster and learn more from working language while implementing other projects than sitting forever and theoretically decide which feature or syntax is better.

Simplified Skila is the last chance for my own language — either I manage to pull this off and use it, or I won’t have any more time for language development, simply because I have other solid projects waiting for implementation, and however tempting is having nice language, it is not material for startup. All other projects are.

To end this post — some good readings, a blog OnStartups and few years old (I got to know about it a week ago) but still interesting reading about work culture in Netflix.

Tagged , ,

Interactive Computer Graphics

While MOOC popularity is still on the rise I think the quality of the courses is dropping. And so it is a pleasure to see a new solid course — “Interactive Computer Graphics” by Prof. Takeo Igarashi. Judging from two weeks so far it is very inspiring, refreshing and simply entertaining — if you are interested in graphics, animation, user interface you should enjoy it as well.

Tagged , , , ,

Swift — all good names were already taken…

…so we stole this one.

When Google introduced theirs “Go” some (including me) were concerned about similarity with already existing language “Go!”. But try to sue Google over one character. Who can stop rich, right?

Same story with Apple now — they just introduced new programming language called “Swift”. The name, you have to admit, has the striking resemblance with already existing programming language called “Swift”. Hmm, maybe the typeface is changed at least.

So far I just peeked at the basic syntax, and it looks interesting. As always, there is a question if it is good enough to stop developing my own language…

Tagged , ,

Hack — smooth evolution

One thing I like about PHP is its hosting ubiquity — you can start away for free. I wonder if Hack will become equally successful.

Hack is a new language from Facebook, and while its syntax does not give me chills:

<?hh
class MyClass {
  const int MyConst = 0;
  private string $x = '';
  public function increment(int $x): int {
    $y = $x + 1;
    return $y;
  }
}

it simply might be good enough to gain acceptance. It is very interesting for sure, and Facebook prepared its website well, there is a interactive tutorial which looks rather like a mini course, and it is fun too.

One thing surprises me — with such effort and solid features, such a lame name? Somebody missed the lesson of “Go”.

Tagged , , ,

Variadic functions — it’s clean up time

OK, I did it. The last feature I wanted to have in my intro toolbox — variadic functions. This time I borrowed the design from Scala, not from C# because I like it better — especially in cases when you use template function and it is unclear whether your array will be passed as one argument or expanded to multiple arguments:

var arr = new Array<Int>(5);
foo(arr);
foo(arr:~);

Assuming “foo” is variadic function taking “Ints” the first call is incorrect, only the second works because it unfolds entire array and passes the values one by one (technically it unfolds nothing, it is just semantic notion).

However even Scala is not complete — too often I need to write variadic function with at least 2 parameters. Since I didn’t see everything Skila has flexible limits:

func foo(params[2..20] p Int) ...
func foo(params[2..] p Int) ...
func foo(params[..20] p Int) ...
// not too much sense, if you ask me
func foo(params[2] p Int) ... 

I could say this is the time I rest a bit, rethink syntax, try to write some programs for real, and finally upload the first version of Skila (no matter how embarrassing the code looks like — it is a mess, seriously).

But as it appeared with recent issue of Dr.Dobb’s I also have to read more about programming language Nimrod. At first glance it seems it is well designed, with similar concepts in mind as Skila — I would not like to duplicate the efforts so I have to make sure it is not the last stop for Skila.

Tagged , ,