laziness
See original GitHub issue[@gavinking] As suggested by @RossTate in #3594, we could define a class Evaluable<Value>
or whatever, as a subtype of Iterable<Value>
, abbreviated to {Value}
, and instantiated using the syntax {val}
, allowing support for lazy evaluation.
For example:
void debug({String} text) {
if (logging.debugEnabled) {
logging.debug(text.evaluate);
}
}
Which would allow lazy evaluation of the log message:
debug({ "New user created: " + user.name });
We would also slightly massage the semantics of named argument lists to allow the following:
debug { "New user created: " + user.name };
This idea would impact { ... }
-style iterable enumerations in general, since they would come with the expectation that the constituent expressions are always evaluated lazily. This is actually more consistent, since that’s also the expectation when a comprehension appears inside { ... }
.
[Migrated from ceylon/ceylon-spec#491]
Issue Analytics
- State:
- Created 11 years ago
- Comments:18 (2 by maintainers)
Top Results From Across the Web
Laziness - Wikipedia
Laziness (also known as indolence) is disinclination to activity or exertion despite having the ability to act or to exert oneself.
Read more >All About Laziness: What Causes It and What to Do About It
According to a study published in 2018 in the journal Human Arenas, laziness can be regarded as a failure to act or perform...
Read more >The Psychology of Laziness
A person is being lazy if he is able to carry out some activity that he ought to carry out, but is disinclined...
Read more >Laziness Definition & Meaning - Dictionary.com
Laziness definition, having or showing an unwillingness to work:Many people start the course with a bang, but trail off after a while because...
Read more >The benefits of laziness: why being a lazy person can be good ...
There are endless pejorative terms to describe lazy people. While laziness can be a negative coping mechanism in depression and anxiety, it is...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I suppose this ancient issue was resolved in favor of https://github.com/ceylon/ceylon/issues/3597#issuecomment-156646707? The following program completes successfully on the JVM & Dart, and as of 1.3.2, JS:
Shall we close it?
Yeah, sure.