Array as a list of parameters

From Lazarus wiki
Revision as of 20:06, 23 October 2006 by Ik 5 (talk | contribs)
Jump to navigationJump to search

Forward

This is an attempt to draw the idea behind using array as a list of values. This values can be added as a list of parameters inside open array/array of const, instead of a variable type of variable, where the type of for example "array of string".

I will try to write the good and bad regarding that issue, and I will try to explain why I think it is a good and in my opinion a very important feature that FPC can have.

This description will bring out problems, or a need to solve something, and will try to explain how this thing can help, or where I can find problems with that feature.

I hope more people will contribute to this drawing, so we could have this feature implemented in the best way we can have.

Why Do we need such feature ?

To answer that question, let me give you examples, that this feature will solve:

  • We have an array of values from an SQL result, and we wish to use that array, to add for example and output using the "format" function. At this point, in order to do so, we will have to create our own "format" function that will take the array and replace string according to the format string rules, so we could go over all of the fields that an array have.

Pros

  • This feature will cause the already existed format function, to be valid without the need to rewrite it.
  • This feature will give better design for how and what data types we are going to use. Instead of writing loops, and even think on different ways of design for output.
  • Instead of rewriting "every"tm function that developers need to deal with array values, while they accept only open array/array of const,