In C# nearly everything is an object, so when writing a unit test for a string property validator it lets me do this: "".PadRight(30);
In C# nearly everything is an object, so when writing a unit test for a string property validator it lets me do this: "".PadRight(30);
But that HURTS my Delphi brain !! Does anyone else suffer from Delphi migraines when using other languages??
But that HURTS my Delphi brain !! Does anyone else suffer from Delphi migraines when using other languages??
Do you know that you can now do " 'foo'.Length" in Delphi now? That surely won't help your migraine ;)
ReplyDeleteActually I didn't know that.. ! I know about the string helper class but I didn't know I could do that - very cool!! But you're right my migraine is now worse :-)
ReplyDeleteYou can also do "100.ToString"...
ReplyDeleteWow that is both interesting and cool and I didn't know it existed in Delphi. So that means the Delphi simple type helpers work with any literals?
ReplyDeleteMost literals, yes. As long as the appropriate unit is used and there is a helper for that type of literal. Most everything should be covered.
ReplyDeleteOk well as the saying goes you learn something every day. Thanks for your insights :-D
ReplyDeleteAllen Bauer Not as cool as a generic extension method in C# ;)
ReplyDeleteStefan Glienke I agree C# extensions are way more powerful than Delphi. I wish Delphi would even allow multiple class/record helpers to be used instead of just the last one referenced.
ReplyDeleteStefan Glienke agreed... But for them to really work well, Delphi would need to have better type inferencing.
ReplyDeleteInterface helpers!
ReplyDeleteany new language has a learning curve, just push forward and youll be fine, in fact, youll find some really nice things in each language that youll want to copy back to delphi
ReplyDeleteAllen Bauer Anything besides elbow grease standing in the way of that? That is, any technical reasons it's so limited?
ReplyDeleteBut then C# still lacks extension properties...
ReplyDeleteJeroen Wiert Pluimers WPF has extension properties which is pretty much that plus a bit more.
ReplyDeleteStefan Glienke those are implemented using Attached Properties which is quite a heavy mechanism: http://www.codeproject.com/Articles/399932/Extension-Properties-Revised
ReplyDeleteCould be worse, though. In Ruby, this is a completely legal (and idiomatic!) way to do a for loop
ReplyDelete5.times {|i| print i, " "}
Mason Wheeler Oh I'm *so* stealing that, let the code rewrite begin!
ReplyDeletetype
TRubyMania = record helper for shortint
procedure times(const IterBody: TProc);
end;
{ TRubyMania }
procedure TRubyMania.times(const IterBody: TProc);
var
i: integer;
begin
for i := 0 to Self-1 do
IterBody(i);
end;
begin
5.times(
procedure(i: integer)
begin
WriteLn(i);
end
);
end.
:D
#codevomit :-D
ReplyDelete