-
Content Count
3711 -
Joined
-
Last visited
-
Days Won
185
Posts posted by David Heffernan
-
-
1 hour ago, Edwin Yip said:How about not to port it to Delphi, but instead, just wrap it as dynamic linking library for the Delphi program to use?
Even harder than porting to delphi.
-
17 minutes ago, Mahdi Safsafi said:He wrote "@stk.Peek" and I understood that he wanted the address of the peeked value.
No. It's clear. He wants the address of the record stored internally by the class to avoid a copy.
-
19 minutes ago, Mahdi Safsafi said:use @stk.List[xxx]
What value of xxx is to be used?
-
12 minutes ago, Mahdi Safsafi said:@Dave Novo As David pointed out, you may need to use @stk.List[xxx].
"may" is rather weak. A more detailed clarification may be useful to the asker, to make it clear that the code you offered does not prevent a copy, and in fact just adds obfuscation.
However, it's also possible that there is premature optimisation going on here.
-
Surely that's just going to copy the record to a temp local, and return the address of that temp local. Or am I missing something?
-
8 minutes ago, Mike Torrettinni said:This happens to me quite often, start with new feature and after a while I see the different naming would be more suitable. So, now changing an alias will be so much easier, because refactoring/rename of type doesn't always work across multiple units.
Then you end up with different names for the same thing. How can that be better?
Refactoring tools get these names changed very reliably.
I don't understand why people are scared of changing names. If you aren't prepared to change names then your code will be a mess.
-
6
-
-
57 minutes ago, Rollo62 said:I can see also benefit in maintaining code.
Imaging you change
TItemArray = TArray<TItem>;
to
TItemArray = TArray<TItemEx>;
In the TItemArray version you touch the code in one place only.
In the TArray<TItemEx> version you touch the code in thousands of places maybe.
Now you have the type named incorrectly in thousands of places. It should be called TItemExArray.
Seems far worse to me.
-
2
-
-
I can't really see any benefit here. I mean you might think that TItemArray is somehow better than TArray<TItem> but they seem pretty interchangeable to me in terms of readability. And the reader has to trust that convention was followed with TItemArray.
-
1
-
-
5 hours ago, chkaufmann said:The order of initialization sections and class constructor is at least partial random.
No. It is deterministic.
-
29 minutes ago, Mike Torrettinni said:Isn't TArray<T> only for generic usage? I use it when I define generic method, and is used like TArray,Method<T>.
Those are two completely different things. One is a generic dynamic array type, the other is a generic method.
-
You are just polluting the namespace for no benefit. Use TArray<T>.
-
2
-
-
D is a truly wonderful language, and Andrei Alexandrescu's book is by some distance the best programming book I have ever read.
-
2
-
-
On 6/13/2020 at 10:17 AM, David Heffernan said:My post above demonstrates that RTTI does exist. I think that the real issue is that these types don't have qualified names.
Basically this then?
-
1 hour ago, Attila Kovacs said:found by accident
So, is it the case that rtti is generated for types declared in the project file, but these rtti types don't have a qualified name?
-
1 hour ago, Mahdi Safsafi said:First, do you really think that I'm missing a basic fact about RTTI ?
I don't think about you at all. I was interested in the question. Try to view comments as impersonal.
1 hour ago, Mahdi Safsafi said:I'm still thinking that you're not understanding neither Attila question nor my answer.
That's entirely possible. I'm interested in learning. It's possible that my misunderstanding is because of imprecise statements. It's possible I'm slow on the uptake.
To be clear, I thought you said that types declared in the project file had no RTTI. I checked that and was able to retrieve RTTI for such types.
I simply don't understand the strength of your reaction.
-
1
-
-
On 6/11/2020 at 11:39 PM, Attila Kovacs said:The question is answered as far as I can see, Ctx.FindType(TypeName) fails on types declared in the dpr, doesn't matter what directives I put there,
@Mahdi Safsafi's answer is very plausible for me, with not having interface section, no public pool for them.
My post above demonstrates that RTTI does exist. I think that the real issue is that these types don't have qualified names.
-
On 6/11/2020 at 9:43 PM, Mahdi Safsafi said:Wasn't said explicitly ... but RTTI is available for public declaration. dpr project (program/library/console,...) are implementation (they don't have interface) those they are not public.
program Project1; {$APPTYPE CONSOLE} uses System.SysUtils, System.Rtti; type TMyClass = class public procedure Foo; end; procedure TMyClass.Foo; begin end; procedure Main; var ctx: TRttiContext; Method: TRttiMethod; begin Method := ctx.GetType(TMyClass).GetMethod('Foo'); Writeln(Method.Name); Writeln(Format('%p', [Method.CodeAddress])); end; begin try Main; except on E: Exception do Writeln(E.ClassName, ': ', E.Message); end; Readln; end.
This demonstrates that what you said is not correct.
-
26 minutes ago, Anders Melander said:Yes, it shouldn't be your primary source of implementation bugs
That's what I mean. Obviously if somebody finds a bug, whoever it is, that's good.
-
23 hours ago, Scott said:Seems like Embarcadero need to increase their Beta testing pool
Beta testing is no substitute for having your own comprehensive set of automated tests. Beta testing is best used to help identify issues with design. It really shouldn't be used to find implementation bugs. I hope that Emba don't do that.
When Emba tell us that they are going to focus on quality, it comes with talk of how many QP issues have been resolved. But for me that misses the point. Unless they are also fixing the development process that allows so many bugs, they will remain stuck on the treadmill, running to stay still.
-
8
-
-
16 minutes ago, Mahdi Safsafi said:Wasn't said explicitly ... but RTTI is available for public declaration. dpr project (program/library/console,...) are implementation (they don't have interface) those they are not public.
RTTI is available for all types, be they public (interface section), or private (implementation section or project file).
-
1 hour ago, Benmik said:It was by no means meant that way. On the contrary, like everybody else I admire and cherish your capabilities as a programmer, but feel bad every time I witness you treating people badly for minor reasons. I pity this, no more and no less.
It just goes to show how easy it can be to misinterpret what people mean.
-
22 minutes ago, Mahdi Safsafi said:Worse they follow grammar mistakes and embarrasses the man in a way (you missed 's', he/she/it ... come on !, ...).
I don't think there's any point in picking up those things. I mean edit a post to resolve them, but no need to comment on them.
23 minutes ago, Mahdi Safsafi said:When you talk with your Doctor, the Doctor is confined by deontological ethics to give you a clean, simple and loyal information. I believe that should applies on SO too (A man asks question because he is confused otherwise he wouldn't ask).
You pay your doctor for a service. Stack Overflow is a little bit different.
24 minutes ago, Mahdi Safsafi said:David and all SO influencers, your voice is heard ! Perhaps, you can start an initiation at least on the Delphi community (this definitely will make a difference).
I have utterly no influence on Stack Overflow.
-
8 minutes ago, Mahdi Safsafi said:Some of my friend refused to use SO just for a moral reason. Moreover, many developers don't agree with their policies.
That's a valid choice. If you don't agree with the site's policies, then you can choose not to use it.
9 minutes ago, Mahdi Safsafi said:For many times, I saw many people get humiliated for trivial reasons by people that just enjoy doing that and SO is not doing a good job there !
There is too much of that going on, I agree.
-
11 hours ago, Benmik said:To mourn over a "noble mind" that has gone astray is certainly nothing that would make many people feel offended.
It came across as patronising and gleeful.
12 hours ago, Benmik said:But neither great merits as a Delphi programmer nor the sophisticated use of Oxford English entitle you to treat people the way you do, especially on stackoverflow. The slightest slip and you are cracking down on the poor devils, and I might be wrong, but in my opinion it has gotten worse in the recent years
I don't agree with that. I think anyone who says that doesn't understand Stack Overflow in the round.
There's a huge problem with Stack Overflow, but it's not what you allude to.
In the beginning the site had very little content and there was a void to be filled by asking questions. After some time the majority of questions had been asked and answered. The overwhelming use of the site is a websearch that leads to topic on the site with an existing question that matches the user's needs. Overwhelmingly users get their answers without asking new questions.
Nowadays there are basically two main form for new questions that get asked
1. A question is asked that has been asked before. These get closed as duplicates.
2. A question is asked by a user that has done no debugging.
Closing duplicates is good for everyone.
The other form of question has no real value. You can answer the question and the asker learns nothing. Or you can try to help the user learn the value of debugging and so be able to do it for themselves in the future. The site doesn't really make it easy to do this, but i firmly believe it's the right thing to do.
As is well known I've spent a lot of time on Stack Overflow over the years. These days I spend very little time there, because interesting questions are so rare. I think perhaps I have a very different perspective of the site than you do given the very different ways that we use them. I think this is an interesting topic, but it's not the topic that this thread is covering. If you want to discuss Stack Overflow, then that would be better in a different thread.
-
1
-
Again with memory leaks and FastMM4
in RTL and Delphi Object Pascal
Posted
Free is implemented as if Assigned(Foo) then Foo.Destroy; so those if statements in the previous post are pointless. Call Free unconditionally.