?

Log in

No account? Create an account
Who, me? [userpic]

Programming language snark

March 11th, 2010 (07:25 pm)
Tags: , ,

Some languages have precise definitions, which let people (and compilers) reason about what a program means. These definitions are called formal semantics.

One type of formal semantics is denotational semantics. It's used mainly for languages like Haskell, where everything is an expression, and nothing has side effects. The denotational semantics of a language tells you what each expression denotes.

Perl seems to be defined with connotational semantics. "Yeah, sure, that looks right."

Comments

Posted by: dsrtao (dsrtao)
Posted at: March 12th, 2010 03:10 am (UTC)

Hey, be fair: it is formally impossible to prove correctness for a Perl program which uses any of several language features.

Or maybe it's impossible to formally prove correctness. See, English isn't so hot either.

Posted by: Who, me? (metageek)
Posted at: March 12th, 2010 02:13 pm (UTC)

Yeah, maybe I should stop writing programs in English.

Posted by: metahacker (metahacker)
Posted at: March 12th, 2010 04:23 am (UTC)
keys

Perl doesn't have semantics so much as a set of challenges that Real Perl Hackers try their best to surmount. (Legibility, stationarity of function, use of alphanumerics, one use per line...)

Posted by: Who, me? (metageek)
Posted at: March 12th, 2010 02:16 pm (UTC)

What's "stationarity of function"?

Posted by: metahacker (metahacker)
Posted at: March 12th, 2010 03:30 pm (UTC)
keys

A sleepy attempt to say that the code does the 'same' thing each time it is encountered during execution. In a language which allows you to rewrite functions on the fly, this is not a sure thing...

Posted by: Who, me? (metageek)
Posted at: March 12th, 2010 04:07 pm (UTC)

Ah, right.

Even C can have trouble with this. You can't define new functions, but you change the value of a function pointer—and calling through a function pointer looks just the same, syntactically, as a regular function call.

Posted by: Siderea (siderea)
Posted at: March 12th, 2010 06:09 pm (UTC)

"Some languages have precise definitions--"
Oh this is gonna be a perl snark, isn't it?
*pagedown*
OH I KNEW IT.

Posted by: Who, me? (metageek)
Posted at: March 12th, 2010 06:10 pm (UTC)

Insert applause here. :-)

8 Read Comments