Keywords 'As' and 'Is'

About Monkey 2 Forums Monkey 2 Development Keywords 'As' and 'Is'

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

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #6300

    nerobot
    Participant

    Question to Mark.

    Is it difficult to implement keywords As and Is like in c#? I think it is more readable then Cast<>.

    So let’s mx2cc do translating into mx-Cast or even c++-dynamic_cast for us. 🙂

    #6304

    Mark Sibly
    Keymaster

    No, but I don’t really like the idea for a number of reasons: I don’t like using new keywords unless absolutely necessary and IMO casting should be a bit ugly anyway, as it can be a sign you’re doing something slightly dodgy.

    Also, I’m not a huge a fan of offering multiple ways to do the same thing unless it clearly achieves something. If Cast<>() can ‘do it all’ why confuse things?

    #6310

    nerobot
    Participant

    1. You can deprecate Cast <> or mark it as deprecated (Need to somehow leave ‘cast’ keyword in help to do search of it).

    2. In docs for As / Is you explain what is under the hood.

    3. This is not absolute necessary but more basic-style IMO.

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

You must be logged in to reply to this topic.