On Sat, 26 Jan 2013, vrt277 wrote:

On 01/25/2013 07:07 PM, Michael Van Canneyt wrote:
The use case presented is SO MARGINAL that it does NOT justify another language feature.
What will you do if you have to iterate through keys of hash table ? c++ stl library have own solution for this: iterator returns structure called "pair" which have 2 fields. First field contains key and second field contains value. (It's similar to situation when you have to return 2 values from function. You can define new type called pair and return 2 values. But I doubt someone likes to do it). Now lets compare c++stl-like solution and for-in-index loop solution:
c++stl-like solution:
container ----> iterator ----> pair (structure stores key-value) -----> pair.key or pair.value
for-in-loop key solution
container ----> iterator ----> key or value

You can do this already. Mattias already showed you how.

Do not let the enumerator return the object, but let it return a record:

Type
  TMyKeyObject = record
    Key : TMyKey;
    Obj : TMyObj;
  end;

Var
 O : TMyKeyObject;

begin
  For O in MyContainer do
    begin
    Writeln(O.Key);
    Writeln(O.Object.ClassName);
    end;

I see nothing wrong with this. It does what you need: return key and value.

If he wants to help, Alexander Klenin had better put his students to useful tasks.
Actually you(and all other developers of fpc) should do it.
I will describe.
I found only one page which describes open issues: http://wiki.freepascal.org/Open_tasks. And you can *not* go to this page from main page of http://www.freepascal.org/. Looks not very contributors-friendly.

That is funny :-)

You are new on the list, and so probably do not know this, but I hate wikis.
Wikis are - by and large - a perfect example of what goes wrong in IT and in 
Open Source:
Lots of things get started. Few are actually finished.

So anything you tell me about the wiki not being up-to-date is just funny to me 
:)

Should be you dislike Perl programming language. But visit http://www.perl.org/ and first thing that you will see "That's why we love Perl 5". They love Perl and they show it. If Freepascal is open project then show it. Describe to everyone how he can support fpc.

Well, I already did so in my other replies:

We do not need more language features.

We do need more code libraries.

If you need concrete examples:

- A native Arbitrary-Precision math library is on the list of Alexander Klenin.

From my personal wishlist:
- HTTPS support for fcl-web.
- A complete DBUS solution.
- XML/XSD -> Pascal types (xml mapper from Delphi)
- A PDF rendering engine that does not depend on a GUI.
- Reporting engine that does not depend on a GUI.
- Charting engine that does not depend on a GUI.
- A mechanism to translate Pascal to Javascript. Integrate with Lazarus.
- Lots of web & database tools.
- A way to design native Java bytecode Android apps in Lazarus.

For many things the start of the building blocks are there.

I'm sure there are many more things. Feel free to put them in the WIKI ;)

But they are all practical things you need in everyday programming to solve programming tasks you will get when you work in an IT company. But these are probably not very interesting from an academic point of view...

Michael.
_______________________________________________
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel

Reply via email to