-
Content Count
3513 -
Joined
-
Last visited
-
Days Won
174
Everything posted by David Heffernan
-
How to pass an unknown record to a function as argument
David Heffernan replied to John Kouraklis's topic in RTL and Delphi Object Pascal
You are quite wrong. No point freeing it. No point even creating it. -
How to pass an unknown record to a function as argument
David Heffernan replied to John Kouraklis's topic in RTL and Delphi Object Pascal
It's not possible. How could it be? -
How to pass an unknown record to a function as argument
David Heffernan replied to John Kouraklis's topic in RTL and Delphi Object Pascal
If the goal is to use RTTI then it seems questionable to use compile time generics. Will result in generic bloat. May as well pass the address of the record and the type info. Or if you want to ensure type safety have the generic method call a further helper method that is non-generic and receives the address of the record and the type info. That avoids the bloat and gives benefit of type safety. -
How to pass an unknown record to a function as argument
David Heffernan replied to John Kouraklis's topic in RTL and Delphi Object Pascal
How will you use RTTI with this? -
Pitfalls of Anonymous methods and capture
David Heffernan replied to Lars Fosdal's topic in RTL and Delphi Object Pascal
It's a typo. Should be SSCCE: http://sscce.org/ -
How to switch condition position?
David Heffernan replied to Mike Torrettinni's topic in Algorithms, Data Structures and Class Design
The point about the order was to be sure that the condition was evaluated. Consider the two settings for the switch: 1. Left to right, condition is first sub expression, therefore it is evaluated. 2. Complete eval, all sub expressions are evaluated, therefore it is evaluated. QED -
How to switch condition position?
David Heffernan replied to Mike Torrettinni's topic in Algorithms, Data Structures and Class Design
You can count on it. http://docwiki.embarcadero.com/RADStudio/Tokyo/en/Expressions_(Delphi)#Complete_Versus_Short-Circuit_Boolean_Evaluation Very surprised you don't know this. -
How to switch condition position?
David Heffernan replied to Mike Torrettinni's topic in Algorithms, Data Structures and Class Design
Nothing to do with implementation details. The Python syntax is simply the Python equivalent of the C conditional operator. You know, the operator that is missing from Delphi. -
Pitfalls of Anonymous methods and capture
David Heffernan replied to Lars Fosdal's topic in RTL and Delphi Object Pascal
It's an extra step for every one of your readers. In fact it's multiple steps. Down file. Unzip file. One goal of the writer is to make it easier for the reader to see and understand. For instance, if I was on a mobile device how would I read files in a zip file? -
How to switch condition position?
David Heffernan replied to Mike Torrettinni's topic in Algorithms, Data Structures and Class Design
That's certainly more concise but it has a completely different meaning. Think about it Rudy. -
How to switch condition position?
David Heffernan replied to Mike Torrettinni's topic in Algorithms, Data Structures and Class Design
Seems kind of a waste of time this entire discussion. The language is well documented and is quite concise. The are only a handful of conditional statements. The syntax for if is clear. You have to write the code in the language that is provided to you. Use an if statement. End of story. -
How to switch condition position?
David Heffernan replied to Mike Torrettinni's topic in Algorithms, Data Structures and Class Design
So you know the answer -
How to switch condition position?
David Heffernan replied to Mike Torrettinni's topic in Algorithms, Data Structures and Class Design
What does the documentation say? -
Pitfalls of Anonymous methods and capture
David Heffernan replied to Lars Fosdal's topic in RTL and Delphi Object Pascal
I'd still see all the replies. It's an interesting topic that you raised but it needs a clearer example to bring out the issue. -
appending to a dynamic array
David Heffernan replied to dummzeuch's topic in Algorithms, Data Structures and Class Design
The subject is dynamic arrays and not open arrays. -
Pitfalls of Anonymous methods and capture
David Heffernan replied to Lars Fosdal's topic in RTL and Delphi Object Pascal
Whatever. The text in the blog post didn't make the types clear. I wasn't about to download some project from a file sharing site. It's quite easy to make a complete program in a simple console app. There must be a few posts on this topic out there already. -
Pitfalls of Anonymous methods and capture
David Heffernan replied to Lars Fosdal's topic in RTL and Delphi Object Pascal
If we have no knowledge of the types involved in this code then for sure we can't know what's wrong with it. -
Should my record be a class instead?
David Heffernan replied to Mike Torrettinni's topic in Algorithms, Data Structures and Class Design
Nothing in that that suggests there is a need for a global variable. -
Should my record be a class instead?
David Heffernan replied to Mike Torrettinni's topic in Algorithms, Data Structures and Class Design
You claim that these global variables "need to be global". Why is that? It would not surprise me if it turned out not to be the case. -
Is there a component that allows me to include proper digital signatures
David Heffernan replied to Dave Novo's topic in Delphi Third-Party
Yeah, seriously you should remove this. As far as the question, I guess you need to decide on exactly what you want to implement. Security concerns are seldom as easy as "just add a signature". You see a lot of people who want to implement security without a solid understanding and it usually ends badly. -
Is there a component that allows me to include proper digital signatures
David Heffernan replied to Dave Novo's topic in Delphi Third-Party
What is Acrobat doing there? Is it a certificate is the security sense, or is it just an image? Now that we have your signature in the image in this post, can't we sign things and pretend to be you? If I steal your cheque book, can't I sign them now as you? -
operator overloding Equal vs Multiply
David Heffernan replied to Eugine Savin's topic in RTL and Delphi Object Pascal
Methods aren't normal functions by that argument, so why are open array parameters fine for them? The real problem here is the decision to allow literals to have type determined by context. So [10] is either a set or an array. That is incompatible with other language features. Like method and operator overloading. There is a good reason why other languages don't attempt to infer type of literals from context. -
operator overloding Equal vs Multiply
David Heffernan replied to Eugine Savin's topic in RTL and Delphi Object Pascal
In this circumstance, for testing equality, why do you believe that a function is better than an operator? -
operator overloding Equal vs Multiply
David Heffernan replied to Eugine Savin's topic in RTL and Delphi Object Pascal
It feels wrong isn't much of an argument. If open array arguments are fine for functions why not for operators, which are just functions with syntactic sugar. Can you explain your objection with reason, rather than relying on what it feels like. And surely you understand why operators are often preferred to functions. -
operator overloding Equal vs Multiply
David Heffernan replied to Eugine Savin's topic in RTL and Delphi Object Pascal
Operators are functions. There are certainly times when it might be useful to use arrays as operator arguments. I regret that the language designers have allowed literals to have meaning determined by context in various places. When there is insufficient context, as is inevitably the case on occasion, these kind of problems arise.