allegro / allegro/opel

Introduce `lazyval`

オープン
#55 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
Java
スター
75
フォーク
16
PR マージ指標
30日以内にマージされた PR はありません

説明

# 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
```

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。