enso-org / enso

Hybrid visual and textual functional programming.
https://enso.org
Apache License 2.0
7.34k stars 323 forks source link

Can't catch the type error. #10236

Closed jdunkerley closed 3 months ago

jdunkerley commented 3 months ago
        resolve filter:Filter_Condition = filter
        case filter of
             : Function -> Panic.catch Any  (resolve filter) ->filter
             -> filter

works but

        case filter of
             : Function -> Panic.catch Any  (filter:Filter_Condition) ->filter
            _ -> filter
JaroslavTulach commented 3 months ago

I am using following program to test the problem:

from Standard.Base import all

type C
    A

main =
    fn x = x+20

    x filter = Panic.catch Any (filter:C) err->
        [err, filter]

    c2 filter = case filter of
        _:Function -> x filter
        _ -> filter

    r3 = c2 fn
    r4 = c2 ..A
    [r3, r4]

yes, it doesn't work properly. The problem is that (filter:C) is evaluated sooner than Panic.catch is called. E.g. it is evaluated as eager argument, not suspended one.

The simplest workaround is to use (identity filter:C)

enso-bot[bot] commented 3 months ago

Jaroslav Tulach reports a new STANDUP for yesterday (2024-06-12):

Progress: - PR for #10236: https://github.com/enso-org/enso/pull/10262

GitHub
Presence of Any disables type checks by JaroslavTulach · Pull Request #10248 · enso-org/enso
Pull Request Description Fixes #10237 by avoiding creation of ReadArgumentCheckNode when the requested type allows Any. Checklist Please ensure that the following checklist has been satisfied befor...
GitHub
Enso language support in VSCode, IGV, etc. · enso-org/enso@b53b669
Hybrid visual and textual functional programming. Contribute to enso-org/enso development by creating an account on GitHub.
enso-bot[bot] commented 3 months ago

Jaroslav Tulach reports a new STANDUP for yesterday (2024-06-13):

Progress: - Persistance API fixes: https://github.com/enso-org/enso/pull/7054/commits/ca528a05e25fd0b7e9a0037a84a5ac96ce326ea3

enso-bot[bot] commented 3 months ago

Jaroslav Tulach reports a new STANDUP for yesterday (2024-06-14):

Progress: - new version of the VSCode extension released on Marketplace thanks to @ola