Sep 01

Perl / Apple / Wireless use: I wanted a boy, but now I will have a daughter?

Apple, Perl, Tech, Wireless 1 Comment »

My wife wants to have a daughter. I would love a son.

However it has been proclaimed that you can predict the sex of your child based on computer usage:

Men who use Apple iBooks/Powerbooks with wireless cards have a very high probability [>85%] of having female offspring that is far greater than the statistical average.

I am trying to do the math based on the fact that I only use Perl a little now, and use both PC and Mac.

(Really, we would be happy with anything)

Aug 20

Parrot 6 internals: PASM and PIR

Perl, Tech 447 Comments »

Oh those crazy Perl guys. They are still working away on Perl 6, and books are already coming out.

Perl 6 and Parrot has a sample chapter which delves into the innards of the Parrot Assembly, and the slightly higher up in the stack Parrot intermediate representation (PIR).

If you are bored of the high level stuff, have some fun reading about this low level stuff instead :)

Aug 03

I’ll name that developer in 5 lines of code!

Groovy, Java, Perl, Tech 7 Comments »

You know the feeling when you open up some code from a fellow programmer, and it says a lot about them?

Their code style speaks to you as does the style of an essay does.

My latest experience is looking at various Groovy code snippets. There have been two extremes that I have come across:

I like my Java, just with a twist

These folks are happy in Java land, and the code looks just like it. There are just a few things differing. Maybe the odd ‘;’ is left off of the statements. Here and there variables aren’t staticly typed. But, mainly, it looks like Java

I want to be different

Some of the guys who have really bitten into Groovy really try hard to have their code NOT look anything like Java. Everything is groovy-fied to the extreme.

This reminds me of some days when I was deep in the Perl community. Since the language gives you 55 ways to do something, you see even more contrasting styles. In that environment you could find the hacker, the one liner, the I have a Comp Sci degree so I code correctly!, the obfuscator, and more.

Fun :)

May 27

Some Perl Fun: Being a poet, and the Perl 6 Periodic Table

Perl, Tech 12 Comments »

The Perl guys know how to have a bit of fun.

Perl 6 has added a slew of operators (I know, I know).

Mark Lentczner then created the Periodic Table of the Operators

Also, Larry Wall was asked again about the great indentation debate (yes Python-ers, we know you are there). He came back with:

Indentation is a wonderful form of commentary from programmer to programmer, but its symbology is largely wasted on the computer. We don’t tell poets how to format their poetry.

You have to love Larry :)

Apr 16

Perl 6 OO: Not as much of a hack ;)

Perl, Tech 1 Comment »

Larry Wall has come out with Apocalypse 12 which details how you will define and use OO in Perl 6.

This is great to see, especially after also being up on the discussions for Groovy on how to handle certain things (e.g. properties).

What does a Perl 6 simple class / use look like now?

class Point {
has $.x;
has $.y is rw;

method clear () { $.x = 0; $.y = 0; }
}

my $point = Point.new(x => 2, y => 3);

$a = $point.y; # okay
$point.y = 42; # okay

$b = $point.x; # okay
$point.x = -1; # illegal, default is read-only

$point.clear; # reset to 0,0

Thank god for the keywords of class (and method). Finally it doesn’t feel like OO is bolted on (even though Larry thinks it was bolted through).

It is interesting that there is no constructor, yet “my $point = Point.new(x => 2, y => 3);” still does the right thing.

And moving from “->” to “.” is nice too.

You may wonder what the “$.x” is all about. This is an interesting use… if you said “$:x” that would make it private! Sneaky huh. You can make private classes via “class :MyPrivateClass {…}”, and private methods via “method :think (Brain $self: $thought)”

Another interesting thing is the part of “roles”.

E.g.

class Dog {
is Mammal;
does Pet;
does Servant;
does Best::Friend[Man];
does Drool;

}

I also enjoyed seeing this Groovy/Ruby/…-ish looking code:

@thumbs.each { .twiddle }

Whatever you think of this document, anyone can see that a LOT of thought has been put into this (as is always the case with Larry), and there are many things in which we can learn from (are you reading this Groovy guys?).

Great stuff. Hopefully we will see Perl 6 in the next 5 years ;)

Nov 08

Bringing Java into Perl

Java, Perl, Tech No Comments »

Ahh, so now when I really want to hack some scripts, but have all of this Java code on the business tier, I can just use Inline::Java :) I can play in the loosely coupled world of Perl on the script side… and have all of the benefits of the well designed Java business objects :)

Or I could use Jython. Or BeanShell. Or …..

Read: Bringing Java into Perl

#!/usr/bin/perl
use strict; use warnings;

use Inline Java => <<'EOJ';
public class Hi {

String greeting;

public Hi(String greeting) {
this.greeting = greeting;
}

public void setGreeting(String newGreeting) {
greeting = newGreeting;
}

public String getGreeting() {
return greeting;
}
}
EOJ

my $greeter = Hi->new(”howdy”);
print $greeter->getGreeting(), “\n”;