Skip to content

Reserve/add and and or with relaxed semantics from [left] only short-circuiting, e.g. allowing & or | #19933

@PallHaraldsson

Description

@PallHaraldsson

What @Ismael-VC wants with #19788 are strict aliases. There are other options, the problem may not be with his code though.*

If taken at face-value, left short-circuiting disallows running first the (or only) right-side:

if slow_function!(x) && fast_function!(y)
  takes_a_long_time_getting_here
else
  or_takes_a_long_time_getting_here
end

I have some ideas to fix that, they may be strictly implementations details, NOT incompatible with left short-circuiting, but then you need lots of prove-work to show absence of "side-effects".

There are two options:

  • Disallow calling functions with side-effects (braking change for && and || but not new operators).
  • Ignoring side-effects!

if fun1!(x) and fun2!(x) # note x-es are repeated, not y as above

is even worse [maybe the other if can work despite the !s ]

If we announce and and or not promising too much, maybe reusing his code (mostly; changes would be elsewhere, and in NEWS.md), then his code could possibly work.

I want to allow running, either side, or both (as &), or even neither (yes, that's a possibility..). And running both sides at once in separate thread, possibly killing them half-way through.

  • I'm unclear on:

`(define is-prec-comparison?
(augment-prec-with-infix prec-comparison 'in 'isa))

[..]

(put! prec-table 'in (get prec-table '== 0)) ; add in to the prec-table
(put! prec-table 'isa (get prec-table '== 0)) ; add isa to the prec-table`

Metadata

Metadata

Assignees

No one assigned

    Labels

    breakingThis change will break codespeculativeWhether the change will be implemented is speculative

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions