Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable "shadowing" of methods? #24

Open
HLWeil opened this issue Aug 21, 2024 · 1 comment
Open

Disable "shadowing" of methods? #24

HLWeil opened this issue Aug 21, 2024 · 1 comment

Comments

@HLWeil
Copy link
Member

HLWeil commented Aug 21, 2024

Given the following class

type Person(name : string) =
    
    inherit DynamicObj()

    let mutable name = name

    member this.Name
        with get() = name
        and set(value) = name <- value

    member this.Walk () = printfn "%s is walking" name

You can currently set a dynamic property with the same name as an existing method.

let p = Person("John")

p.SetValue("Walk", "Shadowing")

p.Walk() // John is walking

p.GetValue("Walk") // val it: obj = "Shadowing"

Should this work, or fail? @kMutagene

@HLWeil HLWeil changed the title [Feature Request] Disable "shadowing" of methods Disable "shadowing" of methods? Aug 21, 2024
@kMutagene
Copy link
Member

Can we even transpile a lookup of the methods or is than non-transpilable reflection?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants