Delphi Programming

and software in general.

Tuesday, November 8, 2011

Google+ Delphi User Groups

A suggestion for self-curating the Delphi content on Google+! Why? Because although we all are lovable developers, we can only handle that many photos, reshares and caturday gifs!

Using Google+ allows us to have a unified comment system, and a loosely coupled Delphi community where you can actually pick and chose among who you want to follow.

Here is how:

Step 1: Create your Google+ Delphi Page. With Google+ adding pages, we now can self-curate our content. This means that each of us can create our own Delphi page, which can be used to promote our blog posts, or our Delphi musings directly in the page stream. Note that we would need to refrain from posting caturday gifs, or reshares of the events of all world+dog on our Delphi page.

Step 2: From your Delphi Page, Follow the Delphi User Group and/or Firemonkey User Group pages This will make your page visible to other Delphi users, assuming you also complete step 3.

Step 3: Ensure that you show in public on your Delphi page profile that you follow the page(s) above. This because a Google+ page will NOT show you as a follower, unless you follow it in public.

Step 4: Pick the pages and/or users you want to follow from the User Group pages. As people publicly add (i.e. follow with) their Delphi pages, the user groups will automatically grow the list of available pages and visible for all.

Step 5: Enjoy a "spam free" Delphi circle!

Step 6: Optionally, reshare your old personal Delphi posts on your Delphi page.

The generic Delphi and Firemonkey user groups are just a start. Anybody can create their own topic-centric User Group page as well.

If you want to help grow the Delphi community:
Create your own Delphi page, and follow the User Groups!

Compile time ordered vectors

I would like to have support for ordering content of a constant array at compile time.

I would like to have optimized lookup function for such an ordered constant array (binary search, hash index, etc, - whatever fits the purpose) to check if a variable has a match in the ordered constant array. The code generator could inline the lookup function if so was desired.

I guess you can say that I am looking for something like the "in" keyword for sets, but extended to work with any constant array (string, array of enumerable, array of number, or array of other constants such as class type references).

A specification syntax could look something like:
  <arraytype> = {ordered {ascending | descending}} Vector<T>

Implicit methods associated with the type:
  Vector<T>.Contains(const element: T):Boolean;
  Vector<T>.ContainsAny(const array of T):Boolean;
  Vector<T>.ContainsAll(const array of T):Boolean;
  Vector<T>.Include(const element: T);
  Vector<T>.Exclude(const element: T);

Example declaration:
type
  TMyType = ordered ascending Vector<Char>;
const
  InvalidChars : TMyType = ['\', ':', '.', '(', ')']; // I don't want to worry about order here


Example of use:
  if InvalidChars.Contains(SomeCharacter) then ...

Today, I can create singleton objects that are ordered as part of the initialization code, but it becomes a lot of micro management code which isn't optimized for call performance, instead of easy to use code like "element in set" style code.