Assignments do an implicit type conversion. In this case, the conversion is from a string ('now') to a date or timestamp. The string to date conversion code that handles 'Oct 14, 2009' can also handle 'now".

If you need to assign 'now' to a string, simply cast 'now' to a date, and the ordinary conversions will generate a canonical date string of appropriate format and content.

I've been using the hack since 1976, so I'm reasonably sure that it works.

Brian Aker wrote:
Hi!

That will only work until someone asks for a function on a differt type :)

Flexibility is a win. For instance a user may want to write their own type.

Cheers,
   --Brian

On Oct 14, 2009, at 1:37 PM, Jim Starkey <[email protected]> wrote:

Brian Aker wrote:
Hi!

On Oct 14, 2009, at 1:09 PM, Jim Starkey wrote:

Implementing 'now' as a manifest constant rather (or in addition to) a pseudo function has much going for it. You can also do 'today', 'tomorrow', 'yesterday', and 'Ann\'s birthday', though the latter is probably less general.

If you did it as a constant, every time you wanted to add a new function you would be modifying an enum. Removing a function? Still sounds bad.

Using a string to match with knowledge that it was a function that was asked for works. One further step might be to identify the version of the function that existed during the creation just to be on the safe side. Or hell... implement COM :)


No, just extend the string to date conversion function. Highly localized, fast, and completely general.


--
Jim Starkey
Founder, NimbusDB, Inc.
978 526-1376




--
Jim Starkey
Founder, NimbusDB, Inc.
978 526-1376


_______________________________________________
Mailing list: https://launchpad.net/~drizzle-discuss
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~drizzle-discuss
More help   : https://help.launchpad.net/ListHelp

Reply via email to