record-like initializer for other classes

Mateusz Romanowski romanowski.mateusz at gmail.com
Fri Jun 19 21:19:11 UTC 2020


Hi,
Since record classes' concept has become stable, I do hope some ideas might
be migrated to less-restricted classes.

I am, I believe, one of many programmers that need to write a lot of
`this.x = x;`-like assignments in constructors and therefore *used to*
abuse static methods' inner classes to save some characters.

Is there any chance to marry inner class' parameter capture with
record-like class initializer?
I.e.,  for class with explicit initializer with a _FormalParameterList_:
* compiler generates implicit or uses compactly declared explicit
constructor with identical _FormalParameterList_,
* for any _FormalParameter_ used outside the constructor, compiler captures
it into implicit final fields *with the same name as parameter*.
Attached please find some translation equivalencies.

What do you think?

Cheers,
Mateusz R.


More information about the amber-dev mailing list