question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[@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:closed
  • Created 11 years ago
  • Comments:18 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
jvasileffcommented, Feb 22, 2017

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:

shared void run() {
    String overflow() => overflow();
    void nolog(Boolean level, String template, {String*} args) {
        if (level) {
            printAll { template, *args };
        }
    }
    nolog { false; "abc"; overflow(), overflow() };
}

Shall we close it?

0reactions
gavinkingcommented, Feb 22, 2017

Yeah, sure.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found