Can <self> be optional?

It would be a nice feature if if was implicit by default under def render, and if you needed to, then you could add the tag.

For the many times that I don’t need to modify , removing it would save me an indentation level for coding.

@ccscanf
@somebee

1 Like

I have had one case in the last week where I spent like 20+ minutes debugging some imba v2 code and it turned out I was missing <self> in the render method. Definitely :+1: from me but I have not thought about the consequences.

In the Scrimba code base <self> is not always used so that might be a challenge or introduce potential regressions for us but Sindre probably has a better overview on this.

1 Like

Yeah - I feel like Self is such a reasonably good thing to assume that it should be the default. Good defaults are always welcome in any language. However, to address the issue where this would be a breaking change - it may be more suitable to change the method signature entirely for an element which doesn’t assume to be tied to Self. Or perhaps it should require a slightly different invocation.

1 Like

@somebee has made a neat change related to this so hopefully a Imba Changelog episode is coming soon.

1 Like