TIP 472: Add Support for 0d Radix Prefix to Integer Literals

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
27 messages Options
12
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

TIP 472: Add Support for 0d Radix Prefix to Integer Literals

Kevin Kenny-6
I see that dkf intends to call the vote on TIP #472.

I have just a couple of questions/concerns.

I may be misreading, but it looks in the sample patch that a bare '0d'
would be accepted as a decimal number? I hope that's simply a bug, and
that '0d' being a number is not intended? (In the eventual
implementation, we should have test cases that '0b', '0o', '0d' and
'0x' without digits following are rejected.) I'm willing to consider
this issue, if indeed it is an issue at all, a bug and not block the
TIP for it.

Next, I see an asymmetry between what is accepted by [scan] and what
is produced by [format]. In any branch that requires death-to-octal,
we should have a change that [format %#o] will produce '0o' notation,
just as [format %#b] and [format %#x] produce '0x' and '0b' in front
of the formatted value. Similarly, we should, with the changes in TIP
#472, make [format %#d] produce '0d' in front of the value.

The changes to [format] could be a separate TIP, but I'd really like
to see them go in at the same time. If the original authors of TIP
#472 aren't willing to take it on, let me know, and I'll do the other
part.

I don't see either of these concerns as being a blocking issue, but
wanted to get them in front of the TIP authors and the community.

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Tcl-Core mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/tcl-core
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: TIP 472: Add Support for 0d Radix Prefix to Integer Literals

Brian Griffin-4

On Jun 11, 2017, at 7:03 PM, Kevin Kenny <[hidden email]> wrote:

I see that dkf intends to call the vote on TIP #472.

I have just a couple of questions/concerns.

I may be misreading, but it looks in the sample patch that a bare '0d'
would be accepted as a decimal number? I hope that's simply a bug, and
that '0d' being a number is not intended? (In the eventual
implementation, we should have test cases that '0b', '0o', '0d' and
'0x' without digits following are rejected.) I'm willing to consider
this issue, if indeed it is an issue at all, a bug and not block the
TIP for it.

Next, I see an asymmetry between what is accepted by [scan] and what
is produced by [format]. In any branch that requires death-to-octal,
we should have a change that [format %#o] will produce '0o' notation,
just as [format %#b] and [format %#x] produce '0x' and '0b' in front
of the formatted value. Similarly, we should, with the changes in TIP
#472, make [format %#d] produce '0d' in front of the value.

The changes to [format] could be a separate TIP, but I'd really like
to see them go in at the same time. If the original authors of TIP
#472 aren't willing to take it on, let me know, and I'll do the other
part.

I don't see either of these concerns as being a blocking issue, but
wanted to get them in front of the TIP authors and the community.

Hi Kevin,

Thanks for your review.  The prototype in the TIP was just preliminary.  There is a full implementation in fossil on the bsg-0d-radix-prefix branch.  This branch addresses your first concern.  I missed the format "#" conversion.  It was my intention to parallel all the 0x behavior throughout Tcl, so, I will address the format option soon.

I've updated the TIP to reflect these issues.

Thanks, Donal, for adding this TIP to your list!

-Brian


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Tcl-Core mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/tcl-core
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: TIP 472: Add Support for 0d Radix Prefix to Integer Literals

Kevin Kenny-6
On Sun, Jun 11, 2017 at 11:00 PM, Brian Griffin <[hidden email]> wrote:

> Thanks for your review.  The prototype in the TIP was just preliminary.
> There is a full implementation in fossil on the bsg-0d-radix-prefix branch.
> This branch addresses your first concern.  I missed the format "#"
> conversion.  It was my intention to parallel all the 0x behavior throughout
> Tcl, so, I will address the format option soon.

Great! Could we also sneak in the change that makes [format %#o]
output '0o' rather than just '0'? (DEATH TO OCTAL!) That's a
(mild) *** POTENTIAL INCOMPATIBILITY *** but should be done
in any branch where octal is already dead.

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Tcl-Core mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/tcl-core
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: TIP 472: Add Support for 0d Radix Prefix to Integer Literals

Brian Griffin-4

On Jun 11, 2017, at 8:24 PM, Kevin Kenny <[hidden email]> wrote:

On Sun, Jun 11, 2017 at 11:00 PM, Brian Griffin <[hidden email]> wrote:

Thanks for your review.  The prototype in the TIP was just preliminary.
There is a full implementation in fossil on the bsg-0d-radix-prefix branch.
This branch addresses your first concern.  I missed the format "#"
conversion.  It was my intention to parallel all the 0x behavior throughout
Tcl, so, I will address the format option soon.

Great! Could we also sneak in the change that makes [format %#o]
output '0o' rather than just '0'? (DEATH TO OCTAL!) That's a
(mild) *** POTENTIAL INCOMPATIBILITY *** but should be done
in any branch where octal is already dead.

Consider it done.
-Brian

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Tcl-Core mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/tcl-core
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: TIP 472: Add Support for 0d Radix Prefix to Integer Literals

Venks Izod
Though I am listed as an author,   Brian did most of the lifting.  
I'll defer to him.   No objections to [format %#d / %#o ]

-Venkat


On Sun, Jun 11, 2017 at 8:26 PM, Brian Griffin <[hidden email]> wrote:

On Jun 11, 2017, at 8:24 PM, Kevin Kenny <[hidden email]> wrote:

On Sun, Jun 11, 2017 at 11:00 PM, Brian Griffin <[hidden email]> wrote:

Thanks for your review.  The prototype in the TIP was just preliminary.
There is a full implementation in fossil on the bsg-0d-radix-prefix branch.
This branch addresses your first concern.  I missed the format "#"
conversion.  It was my intention to parallel all the 0x behavior throughout
Tcl, so, I will address the format option soon.

Great! Could we also sneak in the change that makes [format %#o]
output '0o' rather than just '0'? (DEATH TO OCTAL!) That's a
(mild) *** POTENTIAL INCOMPATIBILITY *** but should be done
in any branch where octal is already dead.

Consider it done.
-Brian

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Tcl-Core mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/tcl-core



------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Tcl-Core mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/tcl-core
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: TIP 472: Add Support for 0d Radix Prefix to Integer Literals

Peter da Silva-2
In reply to this post by Kevin Kenny-6
On 6/11/17, 10:24 PM, "Kevin Kenny" <[hidden email]> wrote:
> Great! Could we also sneak in the change that makes [format %#o] output '0o' rather than just '0'? (DEATH TO OCTAL!) That's a (mild) *** POTENTIAL INCOMPATIBILITY *** but should be done in any branch where octal is already dead.

I would see this as a major incompatibility because I suspect any code in Tcl that is formatting octal output is more likely formatting it for external use (eg generating shell scripts containing chmod commands) than for feeding back to Tcl.

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Tcl-Core mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/tcl-core
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: TIP 472: Add Support for 0d Radix Prefix to Integer Literals

Brian Griffin-4

On Jun 12, 2017, at 4:54 AM, Peter da Silva <[hidden email]> wrote:

On 6/11/17, 10:24 PM, "Kevin Kenny" <[hidden email]> wrote:
Great! Could we also sneak in the change that makes [format %#o] output '0o' rather than just '0'? (DEATH TO OCTAL!) That's a (mild) *** POTENTIAL INCOMPATIBILITY *** but should be done in any branch where octal is already dead.

I would see this as a major incompatibility because I suspect any code in Tcl that is formatting octal output is more likely formatting it for external use (eg generating shell scripts containing chmod commands) than for feeding back to Tcl.

Indeed, there are tcl test failures in the unix file command tests that give me pause...
I will leave the %#o change out of the 0d TIP branch.

-Brian


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Tcl-Core mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/tcl-core
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: TIP 472: Add Support for 0d Radix Prefix to Integer Literals

Jan Nijtmans-2
2017-06-12 15:31 GMT+02:00 Brian Griffin:
> Great! Could we also sneak in the change that makes [format %#o] output '0o'
> rather than just '0'? (DEATH TO OCTAL!) That's a (mild) *** POTENTIAL
> INCOMPATIBILITY *** but should be done in any branch where octal is already
> dead.

It's already implemented in the "z_modifier" branch (along with some other
changes I would like to see appear in 8.7 ...  ). Still to be TIP'ed,
but it's on
my radar.

> Indeed, there are tcl test failures in the unix file command tests that give
> me pause...
> I will leave the %#o change out of the 0d TIP branch.

Well another related issue that should be fixed:
    % format %#x 0
    0x0

This is not according to documentation:
    <http://core.tcl.tk/tcl/artifact/f3e037533b4bd3e0?ln=88-91>
since the "unless it is zero" was never implemented.

I would like the implementation to be changed according to
the documented behavior. Because of compatibility with
the C standard format options. Any objections? If not, I'm
happy to provide the implementation changes.

Regards,
       Jan Nijtmans

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Tcl-Core mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/tcl-core
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: TIP 472: Add Support for 0d Radix Prefix to Integer Literals

Brian Griffin-4

On Jun 12, 2017, at 6:51 AM, Jan Nijtmans <[hidden email]> wrote:

2017-06-12 15:31 GMT+02:00 Brian Griffin:
Great! Could we also sneak in the change that makes [format %#o] output '0o'
rather than just '0'? (DEATH TO OCTAL!) That's a (mild) *** POTENTIAL
INCOMPATIBILITY *** but should be done in any branch where octal is already
dead.

It's already implemented in the "z_modifier" branch (along with some other
changes I would like to see appear in 8.7 ...  ). Still to be TIP'ed,
but it's on
my radar.

Indeed, there are tcl test failures in the unix file command tests that give
me pause...
I will leave the %#o change out of the 0d TIP branch.

Well another related issue that should be fixed:
   % format %#x 0
   0x0

This is not according to documentation:
   <http://core.tcl.tk/tcl/artifact/f3e037533b4bd3e0?ln=88-91>
since the "unless it is zero" was never implemented.

I would like the implementation to be changed according to
the documented behavior. Because of compatibility with
the C standard format options. Any objections? If not, I'm
happy to provide the implementation changes.

I noticed this while updating the documentation for 0d.  (I wonder if this is a feature or a codified bug in the C standard? :)

I'll leave this change with you as it is orthogonal to the 0d TIP.

Thanks,
-Brian


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Tcl-Core mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/tcl-core
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: TIP 472: Add Support for 0d Radix Prefix to Integer Literals

Peter da Silva-2

Apparently in the standard:

 

ISO/IEC 9899:2011 §7.21.6.1 The fprintf function

¶6 The flag characters and their meanings are:
...
# The result is converted to an "alternative form". ... For x (or X) conversion, a nonzero result has 0x (or 0X) prefixed to it. ...

 

 

From: Brian Griffin <[hidden email]>
Date: Monday, June 12, 2017 at 8:59 AM
To: Jan Nijtmans <[hidden email]>
Cc: Tcl Core Mailing List <[hidden email]>
Subject: Re: [TCLCORE] TIP 472: Add Support for 0d Radix Prefix to Integer Literals

 

 

On Jun 12, 2017, at 6:51 AM, Jan Nijtmans <[hidden email]> wrote:

 

2017-06-12 15:31 GMT+02:00 Brian Griffin:

Great! Could we also sneak in the change that makes [format %#o] output '0o'
rather than just '0'? (DEATH TO OCTAL!) That's a (mild) *** POTENTIAL
INCOMPATIBILITY *** but should be done in any branch where octal is already
dead.


It's already implemented in the "z_modifier" branch (along with some other
changes I would like to see appear in 8.7 ...  ). Still to be TIP'ed,
but it's on
my radar.


Indeed, there are tcl test failures in the unix file command tests that give
me pause...
I will leave the %#o change out of the 0d TIP branch.


Well another related issue that should be fixed:
   % format %#x 0
   0x0

This is not according to documentation:
   <http://core.tcl.tk/tcl/artifact/f3e037533b4bd3e0?ln=88-91>
since the "unless it is zero" was never implemented.

I would like the implementation to be changed according to
the documented behavior. Because of compatibility with
the C standard format options. Any objections? If not, I'm
happy to provide the implementation changes.

 

I noticed this while updating the documentation for 0d.  (I wonder if this is a feature or a codified bug in the C standard? :)

 

I'll leave this change with you as it is orthogonal to the 0d TIP.

 

Thanks,

-Brian

 


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Tcl-Core mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/tcl-core
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: TIP 472: Add Support for 0d Radix Prefix to Integer Literals

Brian Griffin-4
In reply to this post by Brian Griffin-4

On Jun 11, 2017, at 8:00 PM, Brian Griffin <[hidden email]> wrote:


On Jun 11, 2017, at 7:03 PM, Kevin Kenny <[hidden email]> wrote:

I see that dkf intends to call the vote on TIP #472.

I have just a couple of questions/concerns.

I may be misreading, but it looks in the sample patch that a bare '0d'
would be accepted as a decimal number? I hope that's simply a bug, and
that '0d' being a number is not intended? (In the eventual
implementation, we should have test cases that '0b', '0o', '0d' and
'0x' without digits following are rejected.) I'm willing to consider
this issue, if indeed it is an issue at all, a bug and not block the
TIP for it.

Next, I see an asymmetry between what is accepted by [scan] and what
is produced by [format]. In any branch that requires death-to-octal,
we should have a change that [format %#o] will produce '0o' notation,
just as [format %#b] and [format %#x] produce '0x' and '0b' in front
of the formatted value. Similarly, we should, with the changes in TIP
#472, make [format %#d] produce '0d' in front of the value.

The changes to [format] could be a separate TIP, but I'd really like
to see them go in at the same time. If the original authors of TIP
#472 aren't willing to take it on, let me know, and I'll do the other
part.

I don't see either of these concerns as being a blocking issue, but
wanted to get them in front of the TIP authors and the community.

Hi Kevin,

Thanks for your review.  The prototype in the TIP was just preliminary.  There is a full implementation in fossil on the bsg-0d-radix-prefix branch.  This branch addresses your first concern.  I missed the format "#" conversion.  It was my intention to parallel all the 0x behavior throughout Tcl, so, I will address the format option soon.

I've updated the TIP to reflect these issues.

Thanks, Donal, for adding this TIP to your list!

%# support for 0d has been added to the bsg-0d-radix-prefix branch, including man page and tests updates.

-Brian


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Tcl-Core mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/tcl-core
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: TIP 472: Add Support for 0d Radix Prefix to Integer Literals

Brian Griffin-4
In reply to this post by Peter da Silva-2

On Jun 12, 2017, at 7:06 AM, Peter da Silva <[hidden email]> wrote:

Apparently in the standard:
 
ISO/IEC 9899:2011 §7.21.6.1 The fprintf function
¶6 The flag characters and their meanings are:
...
# The result is converted to an "alternative form". ... For x (or X) conversion, a nonzero result has 0x (or 0X) prefixed to it. ...

I don't dispute that, but why?  Why is '0' a special case?  Just curious.  Is there some profound logical reasoning behind it, or was it just a case of saving 2 bytes?  Or maybe the very first implementation just fell out this way?

Just curious, like a cat.

-Brian


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Tcl-Core mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/tcl-core
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: TIP 472: Add Support for 0d Radix Prefix to Integer Literals

Peter da Silva-2

I don’t know, the alternate form for hex is something I was not previously aware of... and looking at it this detail it kind of makes the %#x format more or less useless in practice.

 

From: Brian Griffin <[hidden email]>
Date: Monday, June 12, 2017 at 9:13 AM
To: Peter da Silva <[hidden email]>
Cc: Jan Nijtmans <[hidden email]>, Tcl Core Mailing List <[hidden email]>
Subject: Re: [TCLCORE] TIP 472: Add Support for 0d Radix Prefix to Integer Literals

 

 

On Jun 12, 2017, at 7:06 AM, Peter da Silva <[hidden email]> wrote:

 

Apparently in the standard:

 

ISO/IEC 9899:2011 §7.21.6.1 The fprintf function

¶6 The flag characters and their meanings are:
...
# The result is converted to an "alternative form". ... For x (or X) conversion, a nonzero result has 0x (or 0X) prefixed to it. ...

 

I don't dispute that, but why?  Why is '0' a special case?  Just curious.  Is there some profound logical reasoning behind it, or was it just a case of saving 2 bytes?  Or maybe the very first implementation just fell out this way?

 

Just curious, like a cat.

 

-Brian

 


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Tcl-Core mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/tcl-core
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: TIP 472: Add Support for 0d Radix Prefix to Integer Literals

Brian Griffin-4

On Jun 12, 2017, at 7:16 AM, Peter da Silva <[hidden email]> wrote:

I don’t know, the alternate form for hex is something I was not previously aware of... and looking at it this detail it kind of makes the %#x format more or less useless in practice.

Not completely useless, but it certainly complicates things unnecessarily.

-Brian

 
From: Brian Griffin <[hidden email]>
Date: Monday, June 12, 2017 at 9:13 AM
To: Peter da Silva <[hidden email]>
Cc: Jan Nijtmans <[hidden email]>, Tcl Core Mailing List <[hidden email]>
Subject: Re: [TCLCORE] TIP 472: Add Support for 0d Radix Prefix to Integer Literals
 
 
On Jun 12, 2017, at 7:06 AM, Peter da Silva <[hidden email]> wrote:
 
Apparently in the standard:
 
ISO/IEC 9899:2011 §7.21.6.1 The fprintf function
¶6 The flag characters and their meanings are:
...
# The result is converted to an "alternative form". ... For x (or X) conversion, a nonzero result has 0x (or 0X) prefixed to it. ...
 
I don't dispute that, but why?  Why is '0' a special case?  Just curious.  Is there some profound logical reasoning behind it, or was it just a case of saving 2 bytes?  Or maybe the very first implementation just fell out this way?
 
Just curious, like a cat.
 
-Brian
 


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Tcl-Core mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/tcl-core
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: TIP 472: Add Support for 0d Radix Prefix to Integer Literals

Donal K. Fellows-2
In reply to this post by Brian Griffin-4
On 12/06/2017 15:13, Brian Griffin wrote:
> Or maybe the very first implementation just fell out this way?

That's what I'd put my money on. There was a dumb bug and got documented
and turned into holy writ. Wouldn't be the first time this has happened
either, and won't be the last...

Donal.

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Tcl-Core mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/tcl-core

donal_k_fellows.vcf (241 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: TIP 472: Add Support for 0d Radix Prefix to Integer Literals

Kevin Kenny-6
In reply to this post by Brian Griffin-4


On Mon, Jun 12, 2017 at 10:22 AM, Brian Griffin <[hidden email]> wrote:

Why is '0' a special case?  Just curious.  Is there some profound logical reasoning behind it, or was it just a case of saving 2 bytes?  Or maybe the very first implementation just fell out this way?

If I recall correctly, _Software Tools_ had a sample implementation of printf that short-circuited the entire process when printing a zero, because the formatting loop had a 'while (x != 0) { ... }'. Without the special case, zero would have printed as the empty string. (Any bets this is just a bug fix from the initial testing in B?) With Brian Kernighan as an author, _Software Tools_ of course became holy writ.

Tcl is not C, and if we don't see a convincing reason to replicate C's behaviour, we don't have to replicate it. "Because C does it that way," is less than a convincing reason to me. The manual page warns about differences between [format] and sprintf() because they are similar enough that differences are somewhat surprising, but I think that making the # modifier different (so as to output a format that is acceptable to [expr]) is something that we could just document.

As far as %#o goes, remember that I'm talking about the 'death to octal' branches! Some turbulence around octal notation is to be expected when we kill octal. Having the 'alternative format' be 'Tcl's base indication' in all cases is unsusprising. The # modifier is a pretty obscure thing in any case. (I had to look up what it means on %#d. The answer, for C, is "the same as if the # modifier were not present.")


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Tcl-Core mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/tcl-core
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: TIP 472: Add Support for 0d Radix Prefix to Integer Literals

Jan Nijtmans-2
In reply to this post by Donal K. Fellows-2
2017-06-12 16:42 GMT+02:00 Donal K. Fellows:
> That's what I'd put my money on. There was a dumb bug and got documented
> and turned into holy writ. Wouldn't be the first time this has happened
> either, and won't be the last...

Well, either way, we should either adapt the documentation to the
implementation, either the implementation according to the documentation.

My preference would be to adapt the implementation, otherwise the
reason for existence of "%#x" vanishes: you could as well use "0x%x"
(which - I think - most people would use anyway).

My guess is that the reason for this is easying the check for "0".
Printing the number '0' (which is a special-case anyway, because
you cannot strip prefix zero's) can be shortcut without looking
at the format flags, since it will always just output "0".

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Tcl-Core mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/tcl-core
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: TIP 472: Add Support for 0d Radix Prefix to Integer Literals

Donald Porter
In reply to this post by Kevin Kenny-6

> On Jun 12, 2017, at 10:56 AM, Kevin Kenny <[hidden email]> wrote:
> As far as %#o goes, remember that I'm talking about the 'death to octal' branches!

Please note that we have no “death to octal” branches yet from which we
extract releases.  TIP 114 needs a vote to make that happen.  I suggest the
%#o revision belongs attached to TIP 114, and I’m happy to see a vote and
when it passes, I will bless the trunk for 9.0a0 work and push the 8.7 work
onto a new core-8-branch branch.

DGP


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Tcl-Core mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/tcl-core
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: TIP 472: Add Support for 0d Radix Prefix to Integer Literals

Donald Porter

> Please note that we have no “death to octal” branches yet from which we
> extract releases.  TIP 114 needs a vote to make that happen.  I suggest the
> %#o revision belongs attached to TIP 114,

Likewise, people may want to consider how many additions need to be
attached to TIP 472 and its proposed “0d” notation, and how many
might be more easily gathered into another attempt at TIP 297 as
a large scale project to reform Tcl integer handling generally into
something that makes more sense as a coherent whole in Tcl 9, as
well as what migration tools are useful in 8.7 to help scripts move
from one to the other.

DGP


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Tcl-Core mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/tcl-core
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: TIP 472: Add Support for 0d Radix Prefix to Integer Literals

Brian Griffin-4

On Jun 12, 2017, at 8:50 AM, Donald Porter <[hidden email]> wrote:


Please note that we have no “death to octal” branches yet from which we
extract releases.  TIP 114 needs a vote to make that happen.  I suggest the
%#o revision belongs attached to TIP 114,

Likewise, people may want to consider how many additions need to be
attached to TIP 472 and its proposed “0d” notation, and how many
might be more easily gathered into another attempt at TIP 297 as
a large scale project to reform Tcl integer handling generally into
something that makes more sense as a coherent whole in Tcl 9, as
well as what migration tools are useful in 8.7 to help scripts move
from one to the other.

I don't see any other additions to TIP 472.  The scope of '0d' is pretty well bounded.  It was a mistake on my part to consider including octal in the code changes.

As for TIP 297, Venkat's mention of Hardware Description Languages can be relevant here since bit widths are part and partial to literal values, including various semantics around expression behavior w.r.t. sign extension and truncation. (see section 5.7.1 Integer literal constants in the IEEE 1800 standard or 15.5.3 Based literals in the IEEE 1076 standard.)

-Brian

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Tcl-Core mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/tcl-core
12
Loading...