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

Calling a method from a super class on a modified version of self #5990

Closed
vicuna opened this issue Apr 18, 2013 · 1 comment
Closed

Calling a method from a super class on a modified version of self #5990

vicuna opened this issue Apr 18, 2013 · 1 comment

Comments

@vicuna
Copy link

vicuna commented Apr 18, 2013

Original bug ID: 5990
Reporter: @alainfrisch
Status: acknowledged (set by @damiendoligez on 2013-06-19T10:45:12Z)
Resolution: open
Priority: low
Severity: feature
Category: language features

Bug description

A common idiom when using objects and classes to define customizable iterators is the following:

let o = object
  inherit generic_iterator as super

  val path = []

  method! foo x = {< path = x.name :: path >} # super_foo x
  method super_foo = super # foo
end

i.e. one wants to call a method from a super class on a modified version of self (using functional object update). I'm wondering whether it would make sense to have a new language construction allowing such a call directly without going through a "trampoline" method like above; something like:

let o = object
  inherit generic_iterator as super

  val path = []

  method! foo x = {< super with path = x.name :: path >} # foo x
end
@mshinwell
Copy link
Contributor

I don't know whether @alainfrisch is still wondering 7 years later, but if he is, I would suggest an RFC would be the next step if this is to be taken forward.

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

No branches or pull requests

2 participants