POV-Ray : Newsgroups : povray.off-topic : Computer language quirks Server Time
30 Jul 2024 04:13:03 EDT (-0400)
  Computer language quirks (Message 4 to 13 of 33)  
<<< Previous 3 Messages Goto Latest 10 Messages Next 10 Messages >>>
From: Invisible
Subject: Re: Computer language quirks
Date: 3 May 2011 11:43:04
Message: <4dc02288$1@news.povray.org>
On 03/05/2011 16:40, Darren New wrote:
> On 5/3/2011 1:43, Invisible wrote:
>> That's slightly less load.
>
> Still ugly, and non-standard formatting. :-)

Yeah. It's about the best you can do though.

>> Of course, The Real WTF is "functions" that return void. ;-)
>
> Like functions that return unit are better?

How many of those can you name?


Post a reply to this message

From: Warp
Subject: Re: Computer language quirks
Date: 3 May 2011 11:50:30
Message: <4dc02445@news.povray.org>
Darren New <dne### [at] sanrrcom> wrote:
> I find it mildly distracting that I can't do this:

> void xyz() { ... }

> void abc()
> {
>      if (...)
>         return xyz();
>      else blah blah blah;
> }

  What's wrong with:

void abc()
{
     if (...)
        xyz();
     else blah blah blah;
}

  (Structured programming purists would recommend doing it like that
because there's no early return.)

-- 
                                                          - Warp


Post a reply to this message

From: Darren New
Subject: Re: Computer language quirks
Date: 3 May 2011 12:04:57
Message: <4dc027a9$1@news.povray.org>
On 5/3/2011 8:43, Invisible wrote:
>>> Of course, The Real WTF is "functions" that return void. ;-)
>>
>> Like functions that return unit are better?
>
> How many of those can you name?

Not many, but then I work in languages where functions can return void. ;-)

-- 
Darren New, San Diego CA, USA (PST)
   "Coding without comments is like
    driving without turn signals."


Post a reply to this message

From: Darren New
Subject: Re: Computer language quirks
Date: 3 May 2011 12:08:33
Message: <4dc02881@news.povray.org>
On 5/3/2011 8:50, Warp wrote:
>    What's wrong with:

The "else" doesn't end the function, and I tend to have several of these in 
a row, and sometimes it's inside a loop, etc.

>    (Structured programming purists would recommend doing it like that
> because there's no early return.)

I could restructure things, sure, but then it's even more verbose and unlike 
my initial thought processes.  Structured programming wouldn't let me return 
a value from the middle of the function either.  It's the asymmetry between 
a return after a void call and a return after a value-producing call that is 
ugly.


(I had to giggle yesterday when I added an "else break" as the last 
statement of a do-while loop, too.)

-- 
Darren New, San Diego CA, USA (PST)
   "Coding without comments is like
    driving without turn signals."


Post a reply to this message

From: Warp
Subject: Re: Computer language quirks
Date: 3 May 2011 14:36:32
Message: <4dc04b30@news.povray.org>
Darren New <dne### [at] sanrrcom> wrote:
> On 5/3/2011 8:43, Invisible wrote:
> >>> Of course, The Real WTF is "functions" that return void. ;-)
> >>
> >> Like functions that return unit are better?
> >
> > How many of those can you name?

> Not many, but then I work in languages where functions can return void. ;-)

  Well, if we go to the strict definition of "function", that's not the
only problem. For one, strict functions must always return the same value
for the same parameters and must not have side-effects. (Hence eg. rand()
is not a true function.)

-- 
                                                          - Warp


Post a reply to this message

From: Darren New
Subject: Re: Computer language quirks
Date: 3 May 2011 15:02:12
Message: <4dc05134$1@news.povray.org>
On 5/3/2011 11:36, Warp wrote:
> Darren New<dne### [at] sanrrcom>  wrote:
>> On 5/3/2011 8:43, Invisible wrote:
>>>>> Of course, The Real WTF is "functions" that return void. ;-)
>>>>
>>>> Like functions that return unit are better?
>>>
>>> How many of those can you name?
>
>> Not many, but then I work in languages where functions can return void. ;-)
>
>    Well, if we go to the strict definition of "function",

That too. And I would wonder how realistic it is to have a strict function 
returning a "value" that the type system prevents you from ever seeing. 
(I.e., the stuff you use to order calculations in a pure language like Haskell.)

-- 
Darren New, San Diego CA, USA (PST)
   "Coding without comments is like
    driving without turn signals."


Post a reply to this message

From: Orchid XP v8
Subject: Re: Computer language quirks
Date: 3 May 2011 15:52:13
Message: <4dc05ced$1@news.povray.org>
On 03/05/2011 08:02 PM, Darren New wrote:

> That too. And I would wonder how realistic it is to have a strict
> function returning a "value" that the type system prevents you from ever
> seeing. (I.e., the stuff you use to order calculations in a pure
> language like Haskell.)

I'm not sure what you're talking about.

-- 
http://blog.orphi.me.uk/
http://www.zazzle.com/MathematicalOrchid*


Post a reply to this message

From: Darren New
Subject: Re: Computer language quirks
Date: 3 May 2011 16:20:09
Message: <4dc06379@news.povray.org>
On 5/3/2011 12:52, Orchid XP v8 wrote:
> I'm not sure what you're talking about.

Like the IO part of the IO monad.

-- 
Darren New, San Diego CA, USA (PST)
   "Coding without comments is like
    driving without turn signals."


Post a reply to this message

From: Orchid XP v8
Subject: Re: Computer language quirks
Date: 3 May 2011 16:41:12
Message: <4dc06868$1@news.povray.org>
On 03/05/2011 09:20 PM, Darren New wrote:
> On 5/3/2011 12:52, Orchid XP v8 wrote:
>> I'm not sure what you're talking about.
>
> Like the IO part of the IO monad.

The type system doesn't prevent you "seeing" an IO value. You can pick 
them up and move them around just like any other value. It's just that 
you can't do a lot else with them. That's just how the API works; 
nothing to do with the type system.

-- 
http://blog.orphi.me.uk/
http://www.zazzle.com/MathematicalOrchid*


Post a reply to this message

From: Darren New
Subject: Re: Computer language quirks
Date: 3 May 2011 18:10:10
Message: <4dc07d42@news.povray.org>
On 5/3/2011 13:41, Orchid XP v8 wrote:
> That's just how the API works; nothing to do with the type system.

That's what I'm talking about.

-- 
Darren New, San Diego CA, USA (PST)
   "Coding without comments is like
    driving without turn signals."


Post a reply to this message

<<< Previous 3 Messages Goto Latest 10 Messages Next 10 Messages >>>

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