comp.lang.ada
 help / color / mirror / Atom feed
* Lazy evaluation
@ 2014-09-18 19:15 Victor Porton
  2014-09-19 13:51 ` Peter Chapin
  0 siblings, 1 reply; 5+ messages in thread
From: Victor Porton @ 2014-09-18 19:15 UTC (permalink / raw)


Can we incorporate into Ada some kind of lazy evaluation (as in Haskell), 
without breaking backward compatibility?

If yes, would this be much useful?

-- 
Victor Porton - http://portonvictor.org


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Lazy evaluation
  2014-09-18 19:15 Lazy evaluation Victor Porton
@ 2014-09-19 13:51 ` Peter Chapin
  2014-09-19 14:47   ` Dmitry A. Kazakov
  0 siblings, 1 reply; 5+ messages in thread
From: Peter Chapin @ 2014-09-19 13:51 UTC (permalink / raw)


On 2014-09-18 15:15, Victor Porton wrote:

> Can we incorporate into Ada some kind of lazy evaluation (as in Haskell), 
> without breaking backward compatibility?
> 
> If yes, would this be much useful?

Speaking in generalities lazy evaluation tends to make it difficult to
reason about the performance characteristics of a program. It is my
understand this is sometimes a problem for Haskell programs that have
significant performance requirements. Thus it appears that lazy
evaluation would be an anathema as far as Ada is concerned.

Peter




^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Lazy evaluation
  2014-09-19 13:51 ` Peter Chapin
@ 2014-09-19 14:47   ` Dmitry A. Kazakov
  2014-09-23 12:01     ` Victor Porton
  0 siblings, 1 reply; 5+ messages in thread
From: Dmitry A. Kazakov @ 2014-09-19 14:47 UTC (permalink / raw)


On Fri, 19 Sep 2014 09:51:21 -0400, Peter Chapin wrote:

> On 2014-09-18 15:15, Victor Porton wrote:
> 
>> Can we incorporate into Ada some kind of lazy evaluation (as in Haskell), 
>> without breaking backward compatibility?
>> 
>> If yes, would this be much useful?
> 
> Speaking in generalities lazy evaluation tends to make it difficult to
> reason about the performance characteristics of a program. It is my
> understand this is sometimes a problem for Haskell programs that have
> significant performance requirements. Thus it appears that lazy
> evaluation would be an anathema as far as Ada is concerned.

Consider the problem of evaluation order:

   X : String := String'Input (File) & String'Input (File); -- Ill defined!

Now, let "&" be lazy in the right argument:

   function "&" (Left : String; Right : lazy String) return String;

In my opinion, it is not laziness which causes problems, but more the
closures. If closures were limited in some reasonable (from Ada's POV) way,
then laziness would be not an issue.

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Lazy evaluation
  2014-09-19 14:47   ` Dmitry A. Kazakov
@ 2014-09-23 12:01     ` Victor Porton
  2014-09-23 19:12       ` Dmitry A. Kazakov
  0 siblings, 1 reply; 5+ messages in thread
From: Victor Porton @ 2014-09-23 12:01 UTC (permalink / raw)


Dmitry A. Kazakov wrote:

> Consider the problem of evaluation order:
> 
>    X : String := String'Input (File) & String'Input (File); -- Ill
>    defined!

I don't understand why it's ill defined. Please explain.

> Now, let "&" be lazy in the right argument:
> 
>    function "&" (Left : String; Right : lazy String) return String;
> 
> In my opinion, it is not laziness which causes problems, but more the
> closures. If closures were limited in some reasonable (from Ada's POV)
> way, then laziness would be not an issue.

-- 
Victor Porton - http://portonvictor.org


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Lazy evaluation
  2014-09-23 12:01     ` Victor Porton
@ 2014-09-23 19:12       ` Dmitry A. Kazakov
  0 siblings, 0 replies; 5+ messages in thread
From: Dmitry A. Kazakov @ 2014-09-23 19:12 UTC (permalink / raw)


On Tue, 23 Sep 2014 15:01:29 +0300, Victor Porton wrote:

> Dmitry A. Kazakov wrote:
> 
>> Consider the problem of evaluation order:
>> 
>>    X : String := String'Input (File) & String'Input (File); -- Ill
>>    defined!
> 
> I don't understand why it's ill defined. Please explain.

If the stream contains "a" followed by "b", X can be "ab" or "ba" depending
on the evaluation order of arguments.

Compare it with

   expr1 and expr2    vs.   expr1 and then expr2

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2014-09-23 19:12 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-09-18 19:15 Lazy evaluation Victor Porton
2014-09-19 13:51 ` Peter Chapin
2014-09-19 14:47   ` Dmitry A. Kazakov
2014-09-23 12:01     ` Victor Porton
2014-09-23 19:12       ` Dmitry A. Kazakov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox