You are currently browsing the archives for the thoughts tag.

Rant : ECMAScript 4.0

I love JavaScript.

I love JavaScript because it is a simple, concise, prototype based language. Usually, when a language evolves, bugs get corrected and a few features are added to it. This is not the case with JS: ES4 is a completely different language, and yet it is supposed to be JS2. Of course there are some aspects of ES4 which are very interesting, but when you add everything up, ES4 just sucks.

Pros :

  • Non nullable values
  • Expression closures
  • Proper tail calls
  • Meta level hooks (though those should just be special methods of objects)
  • this preservation for nested function calls
  • Array comprehension (concept, not syntax)
  • Destructuring assignement
  • Triple quoted strings (though multilines strings could be nice…)
  • Slicing syntax
  • &&= and ||=

Cons :

  • Typing system : javascript is a script language, if you need a static and strict typed language, use OCaml
  • Records : overlap with objects
  • Classes : JS is prototype based, classes suck
  • Lexical block scoping using let : what's the point ?
  • Iterators
  • Generators
  • 1000 different types of numbers
  • Interfaces

In fact, I'm under the impression that ECMA is trying to transform JS in something like Java1. And this is bad, very bad. Of course JS needs some improvements, but all those stupid features are not, they are pollution.

  1. Did I ever say Java sucked, by the way ? []

A few blog ideas

There is a category of blogs which have some kind of success based only on their concept. I don't talk about usual blogs here, but about those crazy, stupid blogs which can be so amazing. Here are a few ideas for those who would like to start one:

Will it fit in my nose

Everyday a new object, and the same question Will it fit in my nose. A few pictures, some videos and a few words: a whole new way of comparing objects.

The Techno Test

Regularly (once or twice a week) a tech style test of an everyday's life object : plain corn, soap or the mailbox. Thoughts about the licence, accessibility or packaging might be interesting.

Feed Me Tonight

Everyday the blogger publishes the content of his fridge; the readers then make his dinner's menu. When the fridge is empty, the readers might suggest a few ideas. There is a high interaction, and it's a nice place to put some food pictures, videos and recipes.

Show Debugging

Studying movies and TV shows, tracking down all occurences of on screen source code in hackers movies and analyzing the code. Bonus : same thing with maths formulas.

Keyboard use

I've been talking about how much I loved the keyboard over the mouse (for all discrete tasks) for quite some time now, and I think it's time for me to write something about my bad habits.

As most people, I have ten fingers, but I recently realized I didn't use them in the same way when I was typing. In fact, it's quite heterogeneous… I mainly use my left hand's index, middle finger and ring finger as well as my right hand's middle finger and index to type text (which means that my right ring finger is often idle. This also means that my right hand moves a lot (too much?) and this is not efficient.

This represents only half of my fingers. Little fingers are mainly used by the modifiers ctrl> and shift, the right thumb to the space bar, the left thumb to the meta key (which is the modifier used to access all my wm's features) and the right ring finger is bounded to backspace

This means I have a non-optimized way of typing : I use 5 of my fingers to access 8 keys, and the other 5 to use almost all the rest of the keyboard… That's why I'm looking for a way to correct that. Now, the problem is that I'm so used to typing on my keyboard that I do not need any keyboard anymore, I can basically visualize the keyboard and intuitively know where I should place my fingers. That means I have some sort of virtual keyboard somewhere in my brain, and thus I won't be able to optimize my usage of an azerty keyboard.

However, I seriously start to think about switching to a dvorak layout, so that I can take good habits from the start. The only problem I can see is that I will have to loose 12 years of azerty reflex… So, any comments about switching from Azerty to Dvorak (fr) are welcome

Top programming languages

For quite some time I was wondering which programming languages were the most hated on the web, so I did this simple test: I googled "hate [language name]" and here are the results:

501 ruby
733 c++
1260 python
9350 javascript
12100 php
13200 perl
21900 java
50900 c

You are free to deduce whatever you want from those results (I won't say I was not surprised to see C, java and perl in the top 3…)

I then asked myself what was the ratio of existing projects in a language and the number h of results to the previous query. For each language, p is the number of projects using that language on SourceForge.
Let C the repulsion coeffiction of the language, C = h / p. The results are somehow interesting:

0.076 c++
0.362 python
0.942 ruby
1.150 php
1.533 java
4.067 perl
5.276 c
6.216 javascript

Surprise ! C, Java and Perl are still in the top 4, but JS is now first. Another surprise is C++, I thought it would be worse than that…

8 facts about OCaml

OCaml is a language I've blogged about quite a few times, and this is normal: I use it a lot. I'd like today to talk about those little things I like and dislike in OCaml. I won't deal with the usual stuff here (static and strong typing, efficient compiler, functionnal language, etc.)

  • I like:
    • the elegance and conciseness of the language
    • the folds, wonderful for twisted minds
    • if it compiles, it works
    • quite a few other things, but I said I won't talk about strong, static typing ;)
  • I don't like
    • IO is shit: never use print_*, use Printf.
    • regular expressions
    • Gnagna has type t but is here used with type t', where one never know which of the two was inferred
    • did I mention the IO ?