Can we please get a few more upvotes for this feature request?

Can we please get a few more upvotes for this feature request?

https://quality.embarcadero.com/browse/RSP-14867

I know we discussed this already in another post but I think this feature is really nice and will lead to cleaner and more robust code.

What I expect:
- exact same rules as with initializing global variables with one exception: the initialization will happen every time the routine is called
- initialization should happen during the prologue of the routine just as it happens with initialization of managed types variables (like strings, managed records, interfaces, ...).

Before you come up with some made up code example and how it would make things harder to read, understand or debug: please make sure the code you post would stick to the rules I explained above because if it does not we don't need to discuss it.

Comments

  1. Done - have wanted this for a long time.

    ReplyDelete
  2. Voted. Stefan Glienke, I assume we are talking initialization from literals only? I.e. not from f.x. a class function or global function?

    ReplyDelete
  3. The only downside here is that you will draw a line in time, rendering the code not backwards compatible from this point on. I can live with that.

    ReplyDelete
  4. Lars Fosdal "I.e. not from f.x. a class function or global function?"

    If you read everything I wrote you can answer that for yourself:
    Can you currently initialize a global variable from f.x (yes you can if it is a constant expression) or a function (no, you can't because its not a constant expression - I think not even if its an inlined function returning a const)

    "you will draw a line in time, rendering the code not backwards compatible from this point on"

    No code that uses features not available before was ever backwards compatible.

    ReplyDelete

Post a Comment