Hi Jarek,
I agree that this looks more readable, but I'm not sure its good to add
another way to create datetime or timespan instances. We'll need to retain
the convert::to-datetime/timespan anyway ...
We should also stick to using the .NET framework conversion routines to
handle conversion to and from datetime/timespan. Maybe one day we'll allow
users to define the culture in which they want to run NAnt ...
Again, I agree that this is not very readably, but I think this is a problem
with the expression support as such ...
Gert
----- Original Message -----
From: "Jaroslaw Kowalski" <[EMAIL PROTECTED]>
To: "! nant" <[EMAIL PROTECTED]>
Sent: Sunday, February 22, 2004 11:51 PM
Subject: [nant-dev] PATCH: DateTime and TimeSpan literals
> Hi!
>
> I've prepared a nant patch that adds support for datetime and timespan
> literals in expressions.
>
> This is a first step towards improving implicit vs explicit conversions
> issue. Today, the only way to specify a date literal is to use:
> convert::to-datetime("MM/DD/YYYY") which is not very elegant.
>
> I propose a patch that adds:
>
> - datetime literals (enclosed in square brackets)
>
> [YYYY-MM-DD]
> [YYYY-MM-DD HH:MI]
> [YYYY-MM-DD HH:MI:SS]
> [YYYY-MM-DD HH:MI:SS.MIL]
>
> - timestamp literals (enclosed in square brackets, too)
>
> [HH:MI:SS.MIL]
> [HH:MI:SS]
> [DD:HH:MI:SS.MIL]
> [DD:HH:MI:SS]
>
> Additionally it changes SafeConvert to manually produce the
> datetime/timestamp according to the mentioned format. This is used in
> PropertyDictionary.Expand*() to ensure that all datetime strings are
> produced in YYYY-MM-DD [HH:MI:SS[.MIL]] format.
>
> Now, instead of:
>
> convert::to-datetime('01-01-2000') + convert::to-timespan('01:01:01')
>
> you can write:
>
> [2000-01-01] + [01:01:01]
>
> which is definitely more readable and typesafe.
>
> What do you think? May I commit it?
>
> Jarek
>
-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click
_______________________________________________
nant-developers mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/nant-developers