Proposal: nullable wrapper class for primitive data types (int, Number, Boolean)

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Proposal: nullable wrapper class for primitive data types (int, Number, Boolean)

supertodda

Hello,

 

Background ES4 WIKI:  http://wiki.ecmascript.org/doku.php?id=proposals:nullability

Background Flexcoders Discussion: http://tech.groups.yahoo.com/group/flexcoders/message/88001

 

Issue: When working with sql database record sets, often the recordset will return a null value for an int or boolean typed column.  This means the column is in a state of "value undetermined" or "not yet set".  When a recordset is returned into a Adobe Flex 2 VO containing, for instance, an int, the value is reduced to the default value of 0.  Since "not yet determined" and 0 are not equivalent, then this becomes an erroneous conversion and will corrupt any update calls back to the database.  Since the primitive types are not extensible, then there is no current workaround for this issue.

 

Proposal: To allow for a wrapper classes that will enable nullable primitive data types.  Therefore, the type of int, Boolean, Number, etc will still remain the same (not nullable), however a proposed type of NullInt, NullBoolean and NullNumber would behave the same as the primitive types, except allowing them to be set to null.

 

Rationale: Allowing a change such as this allows developers who work with database recordsets (the vast majority) to accurately reflect the data that is in the database.  If the data in the database is automatically converted to a default value in a "hidden" way, then many developers will have an error situation on their hands and may not know why.

 

Thank You.

 

-Todd Anderson


_______________________________________________
Es4-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es4-discuss
Reply | Threaded
Open this post in threaded view
|

Re: Proposal: nullable wrapper class for primitive data types (int, Number, Boolean)

Lars T Hansen-2
Those pages are probably somewhat out of date.

At present we have Boolean, Number, and String which are nullable
wrapper classes for boolean, double, and string, respectively.  Is
there a particular reason you would need specific wrappers for int and
could not make do with Number?

If the recordset "will return a null value for an int typed column"
then arguably the type of the column is (int,null), not int.  The
former is expressible in ECMAScript 4 either like that or as "int?".
Will that not do?

--lars

On 9/21/07, Anderson, Todd <[hidden email]> wrote:

>
>
>
>
> Hello,
>
>
>
> Background ES4 WIKI:
> http://wiki.ecmascript.org/doku.php?id=proposals:nullability
>
> Background Flexcoders Discussion:
> http://tech.groups.yahoo.com/group/flexcoders/message/88001
>
>
>
> Issue: When working with sql database record sets, often the recordset will
> return a null value for an int or boolean typed column.  This means the
> column is in a state of "value undetermined" or "not yet set".  When a
> recordset is returned into a Adobe Flex 2 VO containing, for instance, an
> int, the value is reduced to the default value of 0.  Since "not yet
> determined" and 0 are not equivalent, then this becomes an erroneous
> conversion and will corrupt any update calls back to the database.  Since
> the primitive types are not extensible, then there is no current workaround
> for this issue.
>
>
>
> Proposal: To allow for a wrapper classes that will enable nullable primitive
> data types.  Therefore, the type of int, Boolean, Number, etc will still
> remain the same (not nullable), however a proposed type of NullInt,
> NullBoolean and NullNumber would behave the same as the primitive types,
> except allowing them to be set to null.
>
>
>
> Rationale: Allowing a change such as this allows developers who work with
> database recordsets (the vast majority) to accurately reflect the data that
> is in the database.  If the data in the database is automatically converted
> to a default value in a "hidden" way, then many developers will have an
> error situation on their hands and may not know why.
>
>
>
> Thank You.
>
>
>
> -Todd Anderson
> _______________________________________________
> Es4-discuss mailing list
> [hidden email]
> https://mail.mozilla.org/listinfo/es4-discuss
>
>
_______________________________________________
Es4-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es4-discuss
Reply | Threaded
Open this post in threaded view
|

RE: Proposal: nullable wrapper class for primitive data types (int, Number, Boolean)

supertodda
Just for clairification...  These wrapper classes will be available in
the NEXT version of es4?

If so, this is good news!  Exactly what I needed.  The nullable Number
class works for me in place of int.  Hopefully Adobe will adopt these
classes for Flex development.

Thanks,
-Todd

-----Original Message-----
From: [hidden email] [mailto:[hidden email]] On Behalf
Of Lars T Hansen
Sent: Friday, September 21, 2007 3:07 PM
To: Anderson, Todd
Cc: [hidden email]
Subject: Re: Proposal: nullable wrapper class for primitive data types
(int, Number, Boolean)

Those pages are probably somewhat out of date.

At present we have Boolean, Number, and String which are nullable
wrapper classes for boolean, double, and string, respectively.  Is
there a particular reason you would need specific wrappers for int and
could not make do with Number?

If the recordset "will return a null value for an int typed column"
then arguably the type of the column is (int,null), not int.  The
former is expressible in ECMAScript 4 either like that or as "int?".
Will that not do?

--lars

On 9/21/07, Anderson, Todd <[hidden email]> wrote:

>
>
>
>
> Hello,
>
>
>
> Background ES4 WIKI:
> http://wiki.ecmascript.org/doku.php?id=proposals:nullability
>
> Background Flexcoders Discussion:
> http://tech.groups.yahoo.com/group/flexcoders/message/88001
>
>
>
> Issue: When working with sql database record sets, often the recordset
will
> return a null value for an int or boolean typed column.  This means
the
> column is in a state of "value undetermined" or "not yet set".  When a
> recordset is returned into a Adobe Flex 2 VO containing, for instance,
an
> int, the value is reduced to the default value of 0.  Since "not yet
> determined" and 0 are not equivalent, then this becomes an erroneous
> conversion and will corrupt any update calls back to the database.
Since
> the primitive types are not extensible, then there is no current
workaround
> for this issue.
>
>
>
> Proposal: To allow for a wrapper classes that will enable nullable
primitive
> data types.  Therefore, the type of int, Boolean, Number, etc will
still
> remain the same (not nullable), however a proposed type of NullInt,
> NullBoolean and NullNumber would behave the same as the primitive
types,
> except allowing them to be set to null.
>
>
>
> Rationale: Allowing a change such as this allows developers who work
with
> database recordsets (the vast majority) to accurately reflect the data
that
> is in the database.  If the data in the database is automatically
converted
> to a default value in a "hidden" way, then many developers will have
an

> error situation on their hands and may not know why.
>
>
>
> Thank You.
>
>
>
> -Todd Anderson
> _______________________________________________
> Es4-discuss mailing list
> [hidden email]
> https://mail.mozilla.org/listinfo/es4-discuss
>
>
_______________________________________________
Es4-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es4-discuss
Reply | Threaded
Open this post in threaded view
|

Re: Proposal: nullable wrapper class for primitive data types (int, Number, Boolean)

Lars T Hansen-2
On 9/21/07, Anderson, Todd <[hidden email]> wrote:
> Just for clairification...  These wrapper classes will be available in
> the NEXT version of es4?

There is only one version of ES4 (after that it will be ES5...)
ActionScript 3 serves as a basis for ES4 but ES4 is not quite
compatible with AS3.

The ES4 design docs on the wiki do not always explain the current
state of the language; we're not updating them any more.

(Tentatively the ES4 spec will be complete next year.)

> If so, this is good news!  Exactly what I needed.  The nullable Number
> class works for me in place of int.

Excellent.

--lars

> Hopefully Adobe will adopt these classes for Flex development.
>
> Thanks,
> -Todd
>
> -----Original Message-----
> From: [hidden email] [mailto:[hidden email]] On Behalf
> Of Lars T Hansen
> Sent: Friday, September 21, 2007 3:07 PM
> To: Anderson, Todd
> Cc: [hidden email]
> Subject: Re: Proposal: nullable wrapper class for primitive data types
> (int, Number, Boolean)
>
> Those pages are probably somewhat out of date.
>
> At present we have Boolean, Number, and String which are nullable
> wrapper classes for boolean, double, and string, respectively.  Is
> there a particular reason you would need specific wrappers for int and
> could not make do with Number?
>
> If the recordset "will return a null value for an int typed column"
> then arguably the type of the column is (int,null), not int.  The
> former is expressible in ECMAScript 4 either like that or as "int?".
> Will that not do?
>
> --lars
>
> On 9/21/07, Anderson, Todd <[hidden email]> wrote:
> >
> >
> >
> >
> > Hello,
> >
> >
> >
> > Background ES4 WIKI:
> > http://wiki.ecmascript.org/doku.php?id=proposals:nullability
> >
> > Background Flexcoders Discussion:
> > http://tech.groups.yahoo.com/group/flexcoders/message/88001
> >
> >
> >
> > Issue: When working with sql database record sets, often the recordset
> will
> > return a null value for an int or boolean typed column.  This means
> the
> > column is in a state of "value undetermined" or "not yet set".  When a
> > recordset is returned into a Adobe Flex 2 VO containing, for instance,
> an
> > int, the value is reduced to the default value of 0.  Since "not yet
> > determined" and 0 are not equivalent, then this becomes an erroneous
> > conversion and will corrupt any update calls back to the database.
> Since
> > the primitive types are not extensible, then there is no current
> workaround
> > for this issue.
> >
> >
> >
> > Proposal: To allow for a wrapper classes that will enable nullable
> primitive
> > data types.  Therefore, the type of int, Boolean, Number, etc will
> still
> > remain the same (not nullable), however a proposed type of NullInt,
> > NullBoolean and NullNumber would behave the same as the primitive
> types,
> > except allowing them to be set to null.
> >
> >
> >
> > Rationale: Allowing a change such as this allows developers who work
> with
> > database recordsets (the vast majority) to accurately reflect the data
> that
> > is in the database.  If the data in the database is automatically
> converted
> > to a default value in a "hidden" way, then many developers will have
> an
> > error situation on their hands and may not know why.
> >
> >
> >
> > Thank You.
> >
> >
> >
> > -Todd Anderson
> > _______________________________________________
> > Es4-discuss mailing list
> > [hidden email]
> > https://mail.mozilla.org/listinfo/es4-discuss
> >
> >
>
_______________________________________________
Es4-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es4-discuss
Reply | Threaded
Open this post in threaded view
|

Re: Proposal: nullable wrapper class for primitive data types (int, Number, Boolean)

David Teller-3
On Fri, 2007-09-21 at 17:08 +0200, Lars T Hansen wrote:

> The ES4 design docs on the wiki do not always explain the current
> state of the language; we're not updating them any more.
>
> (Tentatively the ES4 spec will be complete next year.)

Hey, where should I get my daily dose of ES4 updates, then ?

More seriously, my work requires that I should keep at least vaguely
up-to-date with ES4. What should I do ?

Cheers,
 David
--
David Teller ------------------------------------------
Security of Distributed Systems -----------------------
-- http://www.univ-orleans.fr/lifo/Members/David.Teller
----- Laboratoire d'Informatique Fondamentale d'Orleans

_______________________________________________
Es4-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es4-discuss
Reply | Threaded
Open this post in threaded view
|

Re: Proposal: nullable wrapper class for primitive data types (int, Number, Boolean)

Lars T Hansen-2
On 9/22/07, David Teller <[hidden email]> wrote:

> On Fri, 2007-09-21 at 17:08 +0200, Lars T Hansen wrote:
>
> > The ES4 design docs on the wiki do not always explain the current
> > state of the language; we're not updating them any more.
> >
> > (Tentatively the ES4 spec will be complete next year.)
>
> Hey, where should I get my daily dose of ES4 updates, then ?
>
> More seriously, my work requires that I should keep at least vaguely
> up-to-date with ES4. What should I do ?

Right now the proposals on the wiki plus the public version of the
reference implementation plus the base document together form the best
public approximation, but all are somewhat out of date.

Wait for a trickle of early drafts to start in the not too far future.

--lars
_______________________________________________
Es4-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es4-discuss