Question about TDictionary in DX10.2:

Question about TDictionary in DX10.2:

I have a TDictionary< integer, string >.

So if I've got a string value 's', how do I do a reverse lookup to find the integer key associated with this value?

The only thing I've found that works is to explicitly loop over the list and look for an item with a matching Value. But I'd think there would be built-in function to do that.

Comments

  1. David Heffernan All good points, yes. I agree re the compiler items being ones only we can do. But we do want the RTL to have a good baseline.

    ReplyDelete
  2. I generally agree with David Heffernan sentiments above. However, there are folks who have a hard-line against using 3rd-party components of any kind. I'm sure there are plenty of Java shops that don't use Spring, but that doesn't mean that they have to forego the basic stuff included in Java's RTL that are completely missing from Delphi. Adding Map, Reduce, and Filtering is not all that difficult, although making a more "fluent" style of interface is more involved. And adding Interfaces is another level of complexity again.

    That said, it's through the process of building rich and complex native RTLs like this that the compiler team gets to experience the same joys of compiler limitations that 3rd-party devs have been complaining about for a long time. Indeed, I've often wondered if part of the fact that richer RTLs are missing is due to lack of desire to fix compiler issues. It's part of the "eating your own dog food" argument that Delphi's core dev team (and/or leaders) have seemed to prefer avoiding over the years. The folks who've struggled to build richer libs like this have all complained bitterly about a small handful of issues that have been constantly ignored and ultimately make their work far harder and the code more brittle. If the guys in the factory had to deal with them, these issues might actually stand a chance of getting resolved.

    We're lucky that there are a few brave souls in the field who have dared to take on this fight, but it shouldn't be such an uphill battle.

    Delphi is the product of a commercial development organization that charges a pretty penny for their products. How is it that a completely free, open-source platform like Java is evolving far faster with a ton more attention to detail and much richer and well-designed libraries?

    (Of course, Oracle has a lot more money to spend from other sources even if it isn't generated directly by their language products. But still, it's hard to see where the Delphi revenues are going when it sure doesn't seem like they're being used to enhance either the core language or the RTL in ways that keep it competitive with other offerings.)

    ReplyDelete
  3. David Schwartz Personally I have little sympathy for people that refuse to use third party libraries. That's really their problem and we should not let the tail wag the dog.

    ReplyDelete

Post a Comment