POV-Ray : Newsgroups : povray.off-topic : A surprising discovery : Re: A surprising discovery Server Time
5 Sep 2024 11:24:05 EDT (-0400)
  Re: A surprising discovery  
From: Invisible
Date: 24 Jul 2009 04:38:30
Message: <4a697306@news.povray.org>
Warp wrote:

>   Will Haskell ever become mainstream? Yes, as soon as highly theoretical
> math papers become mainstream. ;)

I know you think you're being funny, but let us examine that claim for a 
moment...



SQL is based on some highly theoretical mathematics: the relational 
algebra. Everybody thinks they're called "relational databases" because 
tables can have "relationships". However, this is false; it's because 
"tables" are actually *relations*. You know what the definition of a 
relation is?

   "A relation is a subset of the extended Cartesian product of the 
domains of its respective attributes."

Seriously. That's the definition of a relation. It's a set of tuples. A 
Cartesian product. As soon as you start to dig into this stuff, you 
rapidly find yourself reading about set theory, predicate logic, 
functions and determinents, the relational operators of projection, 
restriction and Cartesian product, the algebra of those operations 
(i.e., how you can reorder them and still get the same result), 
existential vs universal quantification, normalisation rules... and so 
on and so forth.

   Dr Constable: "Boyce Codd Normal Form states... Andrew!"
   Andrew: "...every determinent is a candidate key."
   Dr Constable: "...thank you Andrew. What this means[...]"

I have Database Systems by C J Date on my bookshelf. It's freakin' HUGE, 
and some of the chapters contain utterly impenetrable mathematics that 
even I can't begin to comprehend. (Anybody have any clue how the 
relational calculus is different from the relational algebra??)

And yet... relational databases are the most popular kind of databases. 
SQL is almost the *only* language for controlling databases. SQL is 
basically the relational algebra with COBOL-style syntax. And yet, when 
you write some statement in relational algebra, everybody's eyes glaze 
over. But write some SQL, and people are much happier.

SQL is actually quite easy to understand. You just need to know about 
tables and joins and normalisation and you're basically done. (Obviously 
if you're going to make a professional career out of this stuff, there's 
a lot more to it than you might think. But the basics are quite easy.)

Tell somebody that it's more efficient to take the disjunction of two 
predicates rather than the union of two relations and they look at you 
all confused. But tell them to use an OR-clause in their WHERE-condition 
rather than doing a UNION query and they usually understand.

It seems to be simply a question of how you dress up the terminology. 
You talk about abstract relations and domains and set-theoretic 
operations and predicates and people look confused. Talk about SQL 
statements and most people seem to not have a problem with it; I guess 
because SQL seems far more concrete and "real-world".



All of this makes me wonder... What would happen if somebody designed a 
language which was exactly like Haskell, but had syntax like Pascal or 
something? What if it didn't use terms like "monad" and "functor" and 
"existential quantification", but used something more concrete-sounding?

Of course, the really bizare (and wonderful!) thing about Haskell isn't 
its syntax, it's the ways in which you can use it. But I wonder... If 
you dressed Haskell up in sheep's clothing, how long would it take 
normal programmers to realise that what you're getting them to do is 
actually crazy? >:-)


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.