Am 07.11.2017 um 13:42 schrieb Michael Van Canneyt via Lazarus:

I don't see why you would need a separate package. fpexprparser is in the
FCL since 10 years or so. A separate unit is definitely good so as to
minimize the dependencies of the basic tachart unit, but a package ? Seems overkill to me ?

Maybe I am paranoid here or oversensitive because it has never been clear to me whether "unused" code is linked into a program or not. When there is designtime or initialization code "unused" code may be called internally although it is never called explicitly by the program itself. To be specific: How much of the otherwise unused fpexprparser is linked into a program if the initialization code of the TExpressionSeries unit adds the series to the list needed by the series editor at designtime? Probably none, but I am not sure... Therefore I follow the strategy to keep packages as slim as possible and I want them to contain only the code they need for their main job. For TAChart, the main job is to plot data, not to evaluate functions. Therefore, the formula parser should stay outside the chart package in this way of thinking. In particular since there are other libraries to parse math expressions, such as "symbolic" which is distributed along with fpc as well.

Of course, runtime code should be separated from designtime code in the first place.

Michael, the expression panel allows to add identifiers at designtime. I do understand this for variables, and, in fact, this is great to parameterize the function or to use natural constants. But the IdentifierType can also be itFunctionCallBack, itFunctionHandler, itFunctionNode. Can you explain how these should be handled in practice?

These values can only be handled in code. Of the three, itFunctionHandler can be handled by using an event handler.
But itFunctionCallBack,itFunctionNode make no sense in the designer.
This means: If I select itFunctionHandler then the events OnGetFunctionValue and OnGetVariableValue are fired? In this case TPlotExpressionPanel would behave like TPlotFunctionPanel?

BTW I was suprised to see a collection editor here although there is no explicit code defining it. But then I realized that it's just the clever usage of the word "published" and the selection of the specific inherited class which achieves this. It is amazing how seamlessly the design editors of Lazarus are integrated.

--
_______________________________________________
Lazarus mailing list
[email protected]
https://lists.lazarus-ide.org/listinfo/lazarus

Reply via email to