allegro / allegro/opel

Introduce `lazyval`

Aberta
#55 0 comentários 0 reações 0 responsáveis Ver no GitHub
Linguagem predominante
Java
Estrelas
75
Forks
16
Métricas de merge de PRs
Nenhum PR com merge em 30d

Descrição

# WHY:

currently long boolean expressions cannot be organized and still benefit from lazy evaluation of boolean expressions

ex:

```
(heavyComputationFromASource1() && heavyComputationFromASource2()) || (heavyComputationFromBSource1() && heavyComputationFromBSource2()) || (heavyComputationFromCSource1() && heavyComputationFromCSource2())
```
is not equivalent to
```
val a = heavyComputationFromASource1() && heavyComputationFromASource2()
val b = heavyComputationFromBSource1() && heavyComputationFromBSource2()
val c = heavyComputationFromCSource1() && heavyComputationFromCSource2()

a || b || c
```

as at least `*Source1()` will be evaluated

# PROPOSAL:
With `lazyval` working under the hood as some kind of supplier code below would work and still benefit from lazy evaluation

```
lazyval a = heavyComputationFromASource1() && heavyComputationFromASource2()
lazyval b = heavyComputationFromBSource1() && heavyComputationFromBSource2()
lazyval c = heavyComputationFromCSource1() && heavyComputationFromCSource2()

a || b || c
```

Guia de contribuição

Nenhum guia de contribuição indexado para este repositório

Avaliação

Esta issue ainda não foi avaliada.

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.