A plea for nested classes (sarcastic)

by Colin Adams (modified: 2007 Mar 13)

I was pleased to see that EiffelStudio 6.0 now eliminates the need for an ECF file - all you need to do is supply the name of a root class, and it will compile your program for you.

This opens up some fascinating possibilities.

Thanks to the ECMA committee, we already have nested functions: class TEST create make feature make is -- Execute test. do print ((agent (a, b, c, x: REAL_64): REAL_64 -- Agent to evaluate ax^2 + bx +c do Result := a * ((agent (y: REAL_64): REAL_64 -- Agent to evaluate y^2 do Result := y * y end ).item ([x])) + b * x + c end ).item ([3.0, -2.5, 7.09, 5.6])) end end

Now, if we could only have nested classes too, we wouldn't need to write multiple files, one for each class, we could just write the entire program in one class.

So come on ECMA - please give us nested classes too.

P.S. While you are at it, how about self-modifying agents? I miss the days of my assembler-coding youth.

  • Eric Bezault (17 years ago 14/3/2007)

    Put all classes in one file

    There is no need for nested classes in order to avoid having to write multiple files: just put all classes in the same file. I don't remember whether this is allowed or not in ECMA/ISO Eiffel, but it was in ETL2 and it is implemented in Visual Eiffel. The Gobo Eiffel Tools library has an option to parse several classes in the same file as well. Allowing having several classes in the same file makes the compiler slower (in the same way it is slower when allowing to put classes in files whose name is different from 'classname.e'). But it will be very convenient if one day we have an EiffelScript language.

    • Colin Adams (17 years ago 14/3/2007)


      I had hoped that my postscript was sufficient to indicate that this post was sarcastic.

      There is no need for nested classes, any more than there is a need for nested function (inline agents).

      • Eric Bezault (17 years ago 14/3/2007)

        sarcastic post, informative reply

        Knowing that you don't like inline agents, I indeed understood that this post was sarcastic. But being sarcatic should not prevent from getting some informative replies. There is always something to learn, even from a thread that started by sarcastic post.

    • Till Bay (17 years ago 14/3/2007)

      I didn't get the sarcasm. The title is misleading and might confuse others as it did confuse me.

  • Martin Seiler (17 years ago 14/3/2007)

    nested classes

    I think tuples are in many ways to classes what inline agents are to features. Although the latter is more powerful.

    -- mTn-_-|

    • Andreas Leitner (17 years ago 16/3/2007)

      Made my day


      your just made my day (; Very nice quote!