POV-Ray : Newsgroups : povray.off-topic : Current questions : Re: Current questions Server Time
28 Jul 2024 18:26:26 EDT (-0400)
  Re: Current questions  
From: clipka
Date: 11 May 2013 15:23:57
Message: <518e9acd$1@news.povray.org>
Am 09.05.2013 21:54, schrieb Orchid Win7 v1:

> * Using tab characters instead of spaces.
>
> Whitespace is used to delimit scope in Haskell. A space character is 1
> space wide; a tab character is a different randomly-chosen size in every
> program known to Man. That means that text which appears to line up in
> your text editor may look completely wrong in a different program - or
> to the Haskell compiler, for that matter.

... which is why placing importance on indentation in a programming 
language constitutes a design flaw...


> * Calling functions with tuples.
>
> In anything derived from ALGOL, a function call looks like
>
>    foo(1, 2, 3)
>
> But in Haskell, the correct syntax is
>
>    foo 1 2 3
>
> This works exactly like Bash scripts; the first "word" is the function
> to call, and all subsequent words are arguments. This becomes slightly
> confusing because you can pass a function as an argument to another
> function. That means that the first word is the function to call, but
> the other words might ALSO be functions. Regardless, the FIRST word is
> always the function being called.

I think this is actually a pretty stupid notation for a functional 
programming language; after all, the braced notation is /the/ 
traditional notation for functions in mathematics.

I'd go even further and question the whole concept of passing multiple 
arguments to a function. You can't output multiple values from a 
function (unless using a tuple), so why should you input multiple values 
(unless using a tuple)?


> Code:     print -2
> Means:    print - 2    (I.e., subtract 2 from print.)
> Intended: print (-2)   (I.e., print out -2.)
>
> Notice how all three of these are the exact same bug; function
> application has the highest precedence of any operator, which apparently
> isn't what people are expecting. (The final example is arguably a bug in
> the language specification, but there you have it.)

I wouldn't call the latter case a bug in the language spec. It's the 
whole idea of making function application have highest precedence that 
I'd call a bug.

BTW this wouldn't be a problem if Haskell used the classic "fn(x,y,z)" 
notation for functions.


> Lots of people try to write Haskell like
>
>    data Foobar = Foobar {foo :: Int, bar :: Int, baz :: Int}
>    data Fizz = Fizz {foo :: Bool, wok :: Int}
>
> This doesn't work at all, due to a namespace collision. Basically when
> you define a named field, it also auto-generates a function to fetch the
> value of that field. That is,
>
>    foo :: Foobar -> Int
>    bar :: Foobar -> Int
>    ...etc...
>
> Naturally, there can only be one function in scope named "foo". The net
> upshot of this is that no two records may ever have fields with the same
> name. This is widely considered a language design bug, but nobody has
> yet come up with a satisfactory solution to the problem.

A /severe/ design bug, if I'm asked. Nothing I'd expect from a 
contemporary programming language.


Post a reply to this message

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