> 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 ...

convert::to-datetime is here to stay (for example to convert a value
retrieved from a property), but they are more formal right now - they only
accept one of the mentioned formats, nothing else.

> 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 ...

The conversion routines in .NET aren't as strict as possible (vide
boolean=>double) and looks like MS does them differently than mono in some
cases. We could either file one mono bug after another or just implement our
own conversion functions.

That's what my patch does.

Do you really want to allow the cultures to be specified? Why? This kills
portability IMHO.

> Again, I agree that this is not very readably, but I think this is a
problem
> with the expression support as such ...

;-( What can we do to improve it?

Jarek

> ----- 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
>



-------------------------------------------------------
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

Reply via email to