Aug 15

Optional typing and dynamic languages

JavaScript, Tech with tags: , , 16 Comments »

After listening to Brendan talk about typing on the latest Open Web Podcast episode on ECMAScript Harmony it got me thinking again about optional typing.

It has always bugged me a little to think of type information in my nice clean dynamic languages (Ruby, JavaScript, Python, Perl, etc.).

Looking at even the simplest of code like this (taken from Mike Chamber’s XMPP server in ActionScript 3)

var room:Room = new Room(connection);

It irks me. Just work out that it is a room already won’t you? I know you can do it? You CAN do it. So, leave it out in this case.

Although the type information is optional, it seems that a lot of the code that I have seen in AS3 puts types in all over the place. I somewhat like the idea of using types when you really need them, such as for clear documentation of a core library, or some performance issue that you find is an issue (note: that becomes an issue, not one that is assumed!)

Once you open the door though, can people play that way? Is giving the programmer a bit switch of “shall I put the type in here?” every few seconds a good thing? Especially when the tools try to put the type in all the time?

I also found it very interesting when Brendan talked about how adding type information can actually hurt performance, sharing an example of when var foo:int doesn’t do what you actually need. For me, performance is pretty much out of the window, now, and definitely in the future.

So, I lean towards not needing it. But then I flip over the cards and see stuff like this (note: a mock example):

/**
 * @type Room
 */
var room = new Room(connection);

Ugh. Now we have the worst of all words. We are documenting the code out of band. This is often done for some jsdoc-like tool that will generate docs for you. The problems are:

  • The language itself has no idea about this information. The compiler. Nor, runtime. If there was something that could be done for performance, it couldn’t be
  • How easy would it be to get this out of date. If you change the type no one is going to complain. There is no validation here.
  • Way more verbose!

This alone makes me think that I would rather have optional types just to avoid any hacks like this.

You?

Mar 01

Lisa Awards: Community Waiting for an Update

Comic, Tech with tags: , , , 2 Comments »

Lisa Awards: Community Waiting for an Update

Man, what a wait. 10 years and counting? The community has started to take hold and have updated Perl 5 a lot recently, which most people outside of the core community never see as they wait for the Big One. When Perl 6 and Parrot really hit primetime, I wonder what will happen?

What about the other awards?

Got some ideas for awards you would give?

Feb 29

Lisa Awards: Biggest Hack for a Language Runtime

Comic, Ruby, Tech with tags: , , No Comments »

Lisa Awards: Biggest Hack for a Language Runtime

People make fun of the Ruby MRI runtime. The Java and Pythonistas giggle. What is interesting though is how it has been good enough for a lot of people. However, there is no reason for a Ruby runtime to be that slow, so it is great to see the competition across YARV, Rubinious, and of course JRuby.

The beauty of being slow, is that you have a lot of room to get faster :)

Want to learn about Ruby 1.9? Matz came to Google the other day to talk about it:


What about the other awards?

Got some ideas for awards you would give?

Feb 28

Lisa Awards: Most Original Name for a New Language

Comic, Tech with tags: , , , 3 Comments »

Lisa Awards: Most Original Name for a New Language

You have the originally named languages of A, B, and the popular C. Then Bjarne Stroustrup gets clever and goes for C++. Anders comes along with C# and adds the musical touch.

Walter Bright creates a language that “originates as a re-engineering of C++, but even though it is predominantly influenced by that language, it is not a variant of C++. D has redesigned some C++ features and has been influenced by concepts used in other programming languages, such as Java, C# and Eiffel.”

Walter then named the language …. D.

Other entrants are of course E, and the very new Arc.

What about the other awards?

Got some ideas for awards you would give?

Feb 27

Lisa Awards: Most Format Restrictive Language

Comic, Tech with tags: , , , 1 Comment »

Lisa Awards: Most Format Restrictive Language

Fortran pre-90 was very restrictive. There is the magic of column one, the line numbers, etc.

The original Fortran was written for the IBM 704 and you programmed it on punch cards which is why the restrictions were in place. Before Fortran, most of the community were coding using assembler, and Fortran was a factor of 20 more concise. Take that modern Ruby!

There were some close runners up. Fortran 90 fixed a bunch of these issues, however it was a touch too late.
Some forms of Basic has some of the issues too, namely with the explicit line numbers.

Python should maybe win the award since it is a very modern language, and the restrictiveness that people love or hate are not due to computer needs, but rather a benevolent dictator and his opinions :)

Fortran has also won the award for “programming language name that sounds like a robot from the future”.

What about the other awards?

Got some ideas for awards you would give?

Feb 26

Lisa Awards: Best Comeback for a Programming Language

Comic, Tech with tags: , , 2 Comments »

Lisa Awards: Best Comeback for a Programming Language

If you had mentioned Erlang a few years ago people would have scoffed unless you were programming a telco switch. Now you have Ruby developers spending time checking it out, and dealing with some of the ugliness of the methodname/1 language itself.

You could argue that JavaScript is making a comeback with the Ajax universe expanding all over, but it isn’t like JavaScript has ever disappeared.

The Academy of Computing and Machinery also looked at Lisp, but that hasn’t come back yet… although maybe it will be the language for 2009? Or Smalltalk?

Erlang has previously won awards for “Best Movie for a Programming Language”:

What about the other awards?

Got some ideas for awards you would give?

Feb 14

Microsoft Declares

Comic, Microsoft, Tech with tags: , 2 Comments »

Microsoft Declares

Paul Krill asked Bill Gates about declarative languages and how they are the future (and ironically the past!). Bill talked about some of the work happening at Microsoft:

“Most code that’s written today is procedural code. And there’s been this holy grail of development forever, which is that you shouldn’t have to write so much [procedural] code,” Gates said. “We’re investing very heavily to say that customization of applications, the dream, the quest, we call it, should take a tenth as much code as it takes today.”

“You should be able to do things on a declarative basis,” Gates continued. But this has not caught on partially because of weak data models — first Codasyl and then relational. Stronger data models since have emerged, such as rich schemas around XML as well as modeling work being done by Microsoft and others, Gates said. “We’re bringing the data models up to be much, much richer, and we think in that environment, a lot of business logic can be done in a declarative form. Now, we haven’t totally proven this yet. We’re doing a lot of internal developments ourselves that way,” including some Microsoft business applications, he said.

“We’re not here yet saying that [a declarative language has] happened and you should write a ton less procedural code, but that’s the direction the industry is going,” Gates said. “And, despite the fact that it’s taken longer than people expected, we really believe in it. It’s something that will change software development but more like in a five- to eight-year timeframe than overnight,” he said.

I am guessing that the work of Doug Purdy, ChrisAn, and Don Box is fitting into this world, as well the mentioned work of Brad Lovering.

But…. maybe the future is a port of Jelly ;)

Jan 05

Larry Wall: Programming is Hard, Let’s Go Scripting…

Perl, Tech with tags: , , No Comments »

Larry takes a high level view of the past, present, and future, to create a case for Perl 6.

I hope the future isn’t so far out that Will Smith is the only person alive to see it…. along with some Zombies.

Scripting

But basically, scripting is not a technical term. When we call something a scripting language, we’re primarily making a linguistic and cultural judgment, not a technical judgment.

I see scripting as one of the humanities. It’s our linguistic roots showing through.

Declarational

In Lua, an object is just a hash, and there’s a bit of syntactic sugar to call a hash element if it happens to contain code. Thats all there is. They don’t even have classes. Anything resembling inheritance has to be handled by explicit delegation.

Prototype vs. Class

Real organisms just copy their DNA when they reproduce. They don’t have some DNA of their own, and an @ISA array telling you which parent objects contain the rest of their DNA.

Functional or object-oriented

Of course, some of us can’t make up our minds whether we’d rather emulate the logical Sherlock Holmes or sociable Dr. Watson. Fortunately, scripting is not incompatible with either of these approaches, because both approaches can be made more approachable to normal folk.

Loading...