Inline member visibility

About Monkey 2 Forums Monkey 2 Development Inline member visibility

This topic contains 4 replies, has 3 voices, and was last updated by  cocon 2 years, 3 months ago.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #5877

    cocon
    Participant

    Wouldn’t this be nice?

    I think that it would be nice to set member visibility inline, since you can compact the code better, save some lines.

     

    A typical use case:

    #5883

    codifies
    Participant

    I *had* thought sticking private into a class body would make the following methods private but it seems to do nothing silently public private and protected are all very useful for library writers…

    #5897

    Mark Sibly
    Keymaster

    I *had* thought sticking private into a class body would make the following methods private

    It does – but stuff in a file can ALWAYS see stuff in the same file which may be tripping you up. Kind of a budget ‘friend’ mechanism, but one I like so it’s staying even if you hate it! ‘D does it too’ is my usual excuse…

    As for…

    Private Method MyPrivateMethod()
    End

    …I actually quite like this, the only question being does it change the ‘default’ access to private too? IMO, it shouldn’t, but I can’t give any particularly logical reason why, so I’ve been reluctant to add it. I do want it sometimes though…

    #5914

    codifies
    Participant

    … ah the penny drops, I’ll make a comment in the online docs if I can find somewhere appropriate…

    #6023

    cocon
    Participant

    I actually quite like this, the only question being does it change the ‘default’ access to private too?

     

    I did some code uses cases, but it won’t make a point posting them. For example in C++ you declare visibility regions and place the members there accordingly. In C# you get by default an X class scope for members, any other type of visibility must be declared explicitly at any time.

     

    Monkey currently uses the concept of C++, the bottom line is that this change must come as a “line-saver” and not as a “concept-changer”.

     

    I have created a matrix of possibilities in Spreadsheets and here is what I found. It looks like #1 is the winner:

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.