Archive for the ‘Delphi’ Category.

The cool thing about technology

I went to visit my family over Labor Day.  We hung out, talked, watched some TV, and went out for dinner at a local restaurant.  We took my car, and on the way back, because my stepfather’s always commenting on how cool it is, I let him drive.

He was really impressed by the handling and also by the cool electronics, and that was without even showing him the voice control feature.  He even joked that he was going to borrow it and take it to the next football game so he could back in and watch all the action on the backup camera.  But the thing that really amused me was when he said it was “like driving a Cadillac.” Continue reading ‘The cool thing about technology’ »

Embarcadero, please get off of the wrong side of history.

How to simplify memory management the right way

As I pointed out yesterday, with FastMM available, memory management is so much of a solved problem that it’s a non-problem.  So dropping a performance-killing pseudo-GC “solution” on us is patronizing and insulting in the extreme, not to mention a massive waste of effort that could have been spent actually improving the language and/or standard libraries.  But I did notice one very interesting thing from its implementation: the introduction of the [Weak] attribute, and a few other related attributes, are something fundamentally new in the Delphi language. Continue reading ‘How to simplify memory management the right way’ »

NextGen: Delphi’s “Visual Fred” moment?

There’s been a lot of talk recently about immutable strings in the iOS compiler, which, as Marco pointed out, is not actually implemented (yet) but is just something that’s under consideration.  And it appears that he’s uncomfortable with the removal of AnsiStrings.  That’s a good thing, IMO.  I think they should be put back, particularly for UTF-8 strings. Continue reading ‘NextGen: Delphi’s “Visual Fred” moment?’ »

More dwsLinq improvements: query sources and JSON

When I started writing dwsLinq, I never intended it to just be an integrated SQL query builder.  I did that first because it was both useful and easy to implement, but that was never the end goal.

Over the last few days I’ve taken a big step towards the real goal: developing a general-purpose data querying system.  I factored out all of the SQL-specific stuff into its own unit and created an interface called IQueryBuilder that responds to the various query operators to build an expression tree that can be evaluated by DWS.  You create a recognizer and register it with dwsLinq, that checks the value of your FROM expression and returns an IQueryBuilder if it can create an expression for it.  And once I had that working, I created a second unit with a new implementation of IQueryBuilder, for querying JSON data. Continue reading ‘More dwsLinq improvements: query sources and JSON’ »

dwsLinq update: INTO

I just checked in an update to dwsLinq that covers a big step in its progress: the INTO clause.

This is not quite the same thing as INTO in C#’s version of LINQ.  INTO there basically acts as a naming operator, taking a query expression and giving it a name so that you can use it as a sub-expression in further query work.

I did something different with this.  INTO in dwsLinq takes a function pointer as its argument.  The function has to have a single parameter of type Dataset, and return some value, and the INTO clause changes the output of the entire query expression. Continue reading ‘dwsLinq update: INTO’ »

Work in progress: dwsLinq extension for DWS

I’ve always enjoyed the concept behind LINQ: write SQL-esque queries directly in your code, with the compiler able to provide syntactical and type checks, and automatically generate the correct code to do what you wanted.

Unfortunately, there’s nothing like that available for Delphi.  There could be, if the team would shift their focus to augmenting the language with actual useful features borrowed from managed languages, such as a proper extension method implementation, rather that burdening it with useless, counterproductive crap like pseudo-garbage collection and new String models.  But for the time being, we’re out of luck.

It could be done in DWS, but LINQ is a really complex system that makes heavy use of lambdas (aka anonymous methods,) which Eric Grange hasn’t gotten around to supporting yet outside of the JavaScript cross-compilation.  Apparently it’ll take a complete re-architecting of the execution model to make anonymous methods available.

But a while ago, an idea struck me.  In .NET, LINQ uses anonymous methods to support expression class evaluation at runtime.  But DWS is already an interpreted scripting system that operates on an expression tree!  And since DWS has a language extension mechanism in place, I decided to poke around and see what was possible. Continue reading ‘Work in progress: dwsLinq extension for DWS’ »

Wanted: live leak detection for FastMM

One of the awesome things about FastMM is FullDebugMode.  Its features pretty much make memory leaks trivial to track down… usually.  But if you’ve got the classic problem of code creating objects and placing them in a container somewhere and then abandoning them, you can have a huge memory leak in your program without it ever being detected, just as long as the container gets properly cleaned up before the program shuts down.

Seems to me that it should be possible to detect this with a bit of instrumenting, though.  Here’s the basic idea. Continue reading ‘Wanted: live leak detection for FastMM’ »

The US Supreme Court just ruled that publishers have no right to differential pricing

If you’ve been paying attention to copyright and the myriad ways it gets abused by publishing interests, you’ve probably heard of the Kirtsaeng case.  For those just tuning in, here’s quick recap:

John Wiley & Sons is a publishing company, involved in one of the most despicable fields within the publishing industry: the publication of academic textbooks.  Anyone who’s ever been to college and had to pay the exorbitant rates they charge every semester, just because they can, will need no explanation as to why these guys are scum.

The interesting thing is, while they charge whatever they can, “whatever they can” means different things in different contexts.  Some parts of the world are wealthier than others, and in some countries there’s just less blood available to be squeezed from that particular stone, and so they have to set the prices lower so as not to be unaffordable.

Anyone with a basic knowledge of economics, when presented with these facts, should recognize that an opportunity for arbitrage exists here: buying goods in a low-priced market and reselling them at a profit, where the prices are high.  And that’s exactly what this Thai guy called Supap Kirtsaeng did. Continue reading ‘The US Supreme Court just ruled that publishers have no right to differential pricing’ »

The next RTTI bottleneck

A few years back, when I posted an analysis of how TValue is very slow, it prompted a lot of response from the community.  Various people ran their own benchmarks, and started working on building or optimizing their own meta-value types.  Some people are even still working on that today.  But one of the most interesting things was Robert Love’s response.  He looked at the TValue code and found a way that it could be optimized for the common case to speed things up. Continue reading ‘The next RTTI bottleneck’ »