That's interesting.  I would have thought that MM could have implemented the
concept of null that they have with cfprocparam with the cfreturn statement.
This is probably governed by standards outside of the control of MM, though.

Oh well, I guess that it wasn't too hard to modify.  I just used an IsDate()
and check for empty string on the setter function to make sure that only a
date or empty string can be assigned.

Should I use cfthrow for invalid dates or just return failure to the calling
code?

I'm usually in favor of strong type checking but I have to agree that
ignoring the possibility of NULL is a problem.  If I didn't need to
communicate with a database, I wouldn't be using CF...

Thanks,
sj


> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf
> Of Barney Boisvert
> Sent: Wednesday, May 26, 2004 3:44 PM
> To: [EMAIL PROTECTED]
> Subject: RE: [CFCDev] cffunction returntype="date"
> 
> Nope, you have to return string.  MM really botched it by making a
> language
> with typing that doesn't have the concept of null, but such is life.
> Hopefully the next version will rectify the situation, because it greatly
> affects the ability to use type checking.
> 
> Cheers,
> barneyb
> 
> > -----Original Message-----
> > From: [EMAIL PROTECTED]
> > [mailto:[EMAIL PROTECTED] On Behalf Of Scott Jibben
> > Sent: Wednesday, May 26, 2004 1:36 PM
> > To: [EMAIL PROTECTED]
> > Subject: [CFCDev] cffunction returntype="date"
> >
> > I've got a stupid question that I can't find an answer to.  I
> > have some
> > functions that have a returntype of 'date'.  In some cases,
> > these values
> > will be NULL in the database.  The problem is that when my
> > getter function
> > attempts to return the NULL (empty string) date, the code
> > throws an error
> > because the return type is not a valid date.  Is there a way
> > to return an
> > empty date value with returntype="date" or will I have to change to
> > returntype="string"?
> >
> >   <cffunction access="remote" name="GetSubExpires" output="false"
> > returntype="date" displayname="Get object property" hint="Get
> > dtSubExpires
> > from object">
> >       <cfreturn variables.m_protected.dtSubExpires />
> >   </cffunction>
> >
> >
> >
> > ----------------------------------------------------------
> > You are subscribed to cfcdev. To unsubscribe, send an email
> > to [EMAIL PROTECTED] with the words 'unsubscribe cfcdev'
> > in the message of the email.
> >
> > CFCDev is run by CFCZone (www.cfczone.org) and supported
> > by Mindtool, Corporation (www.mindtool.com).
> >
> > An archive of the CFCDev list is available at
> > www.mail-archive.com/[EMAIL PROTECTED]
> >
> 
> ----------------------------------------------------------
> You are subscribed to cfcdev. To unsubscribe, send an email
> to [EMAIL PROTECTED] with the words 'unsubscribe cfcdev'
> in the message of the email.
> 
> CFCDev is run by CFCZone (www.cfczone.org) and supported
> by Mindtool, Corporation (www.mindtool.com).
> 
> An archive of the CFCDev list is available at www.mail-
> archive.com/[EMAIL PROTECTED]


----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email
to [EMAIL PROTECTED] with the words 'unsubscribe cfcdev' 
in the message of the email.

CFCDev is run by CFCZone (www.cfczone.org) and supported
by Mindtool, Corporation (www.mindtool.com).

An archive of the CFCDev list is available at www.mail-archive.com/[EMAIL PROTECTED]

Reply via email to