Take a quick quiz. A kilobyte is: a) 1000 bytes; b) 1024 bytes. If you have answered [b], then you may be a good programmer (binary-aware) but would sure be a poor scientist. Prefixes ''kilo'', ''mega'' and so on by standard measure in base 10 units (eg ''kilo'' is 10**(3*1), ''mega'' is 10**(3*2) ...). Since computers don''t really care about decimal system, people started misusing these prefixes by measuring sizes in bytes in base 2 units (kilobyte being 2**(10*1)) creating much confusion in the past which resulted in many lawsuits. New prefixes were needed which IEC added to well known SI in 1998 - kibibyte (Ki), mebibyte (Mi) and so on (the terms are short for ''kilobinary'', ''megabinary''...). Now, these were never wide adopted because they "sounded like cat food" to programmers, but they are an international standard and if we are to avoid future confu sion and ambiguity we should use them. I apologize for the history lesson for all you who didn''t need it, but I wanted to turn your attention to ticket 4661<http://dev.rubyonrails.org/ticket/4661>which fixes Numeric#kilobyte and numeric extensions to measure in base 10 units in Rails. It also changes an ActiveView helper for correct capitalization, and - for those hopeless conservatives - provides a method to switch back to old behaviour. Note that the ticket reporter (anonymous) was wrong about ''mibibyte'' - it was a case of misspelling. What do you think of it? Do you agree Rails should stop encouraging prefix misuse? Do developers need this extra method to switch back to old base units for existing apps or should it be removed to force correct practice? Thank you -- Mislav _______________________________________________ Rails-core mailing list Rails-core@lists.rubyonrails.org http://lists.rubyonrails.org/mailman/listinfo/rails-core
Much as I admire the kibibyte concept, I have never seen *anyone* using this in real life. Ultimately, language is determined by usage, not standards, and I think we need to bow to public opinion in this case. I''m okay with a adding kibibyte as a synonym, and encouraging its use, but since we''re targetting programmers (and not scientists) I don''t think we should redefine kilobyte. -- Ernie P. (once a scientist, almost a programmer) On Jun 13, 2006, at 12:50 AM, Mislav Marohnić wrote:> Take a quick quiz. A kilobyte is: > > a) 1000 bytes; > b) 1024 bytes. > > > If you have answered [b], then you may be a good programmer (binary- > aware) but would sure be a poor scientist. Prefixes ''kilo'', ''mega'' > and so on by standard measure in base 10 units (eg ''kilo'' is 10** > (3*1), ''mega'' is 10**(3*2) ...). Since computers don''t really care > about decimal system, people started misusing these prefixes by > measuring sizes in bytes in base 2 units (kilobyte being 2**(10*1)) > creating much confusion in the past which resulted in many > lawsuits. New prefixes were needed which IEC added to well known SI > in 1998 - kibibyte (Ki), mebibyte (Mi) and so on (the terms are > short for ''kilobinary'', ''megabinary''...). > > Now, these were never wide adopted because they "sounded like cat > food" to programmers, but they are an international standard and if > we are to avoid future confu sion and ambiguity we should use them. > > I apologize for the history lesson for all you who didn''t need it, > but I wanted to turn your attention to ticket 4661 which fixes > Numeric#kilobyte and numeric extensions to measure in base 10 units > in Rails. It also changes an ActiveView helper for correct > capitalization, and - for those hopeless conservatives - provides a > method to switch back to old behaviour. Note that the ticket > reporter (anonymous) was wrong about ''mibibyte'' - it was a case of > misspelling. > > What do you think of it? Do you agree Rails should stop encouraging > prefix misuse? Do developers need this extra method to switch back > to old base units for existing apps or should it be removed to > force correct practice? > > Thank you > > -- > Mislav > _______________________________________________ > Rails-core mailing list > Rails-core@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails-core_______________________________________________ Rails-core mailing list Rails-core@lists.rubyonrails.org http://lists.rubyonrails.org/mailman/listinfo/rails-core
> Much as I admire the kibibyte concept, I have never seen *anyone* using this > in real life. Ultimately, language is determined by usage, not standards, > and I think we need to bow to public opinion in this case.<...> BitTorrent client Azureus uses KiB, MiB, etc. I like the idea. Regards, Rimantas -- http://rimantas.com/
I'd also think an alias to kibibyte is reasonable but making kilobyte return 1000 is going to be counter-intuitive to most programmers. I'm not really sure what value a base-10 Numeric#kilobyte has, either, since it's just a boring old power of ten. Maybe the powers of ten are not significantly "weird" enough to warrant shortcut methods? Or maybe they are...perhaps Numeric#kilo, mega, giga, tera, etc would be less contentious (and unit-agnostic). On 6/13/06, Dr. Ernie Prabhakar <drernie@opendarwin.org> wrote:> > Much as I admire the kibibyte concept, I have never seen *anyone* using > this in real life. Ultimately, language is determined by usage, not > standards, and I think we need to bow to public opinion in this case. > I'm okay with a adding kibibyte as a synonym, and encouraging its use, but > since we're targetting programmers (and not scientists) I don't think we > should redefine kilobyte. > > -- Ernie P. > (once a scientist, almost a programmer) > > On Jun 13, 2006, at 12:50 AM, Mislav Marohnić wrote: > > Take a quick quiz. A kilobyte is: > > a) 1000 bytes; > b) 1024 bytes. > > > If you have answered [b], then you may be a good programmer (binary-aware) > but would sure be a poor scientist. Prefixes 'kilo', 'mega' and so on by > standard measure in base 10 units (eg 'kilo' is 10**(3*1), 'mega' is > 10**(3*2) ...). Since computers don't really care about decimal system, > people started misusing these prefixes by measuring sizes in bytes in base 2 > units (kilobyte being 2**(10*1)) creating much confusion in the past which > resulted in many lawsuits. New prefixes were needed which IEC added to well > known SI in 1998 - kibibyte (Ki), mebibyte (Mi) and so on (the terms are > short for 'kilobinary', 'megabinary'...). > > Now, these were never wide adopted because they "sounded like cat food" to > programmers, but they are an international standard and if we are to avoid > future confu sion and ambiguity we should use them. > > I apologize for the history lesson for all you who didn't need it, but I > wanted to turn your attention to ticket 4661<http://dev.rubyonrails.org/ticket/4661>which fixes Numeric#kilobyte and numeric extensions to measure in base 10 > units in Rails. It also changes an ActiveView helper for correct > capitalization, and - for those hopeless conservatives - provides a method > to switch back to old behaviour. Note that the ticket reporter (anonymous) > was wrong about 'mibibyte' - it was a case of misspelling. > > What do you think of it? Do you agree Rails should stop encouraging prefix > misuse? Do developers need this extra method to switch back to old base > units for existing apps or should it be removed to force correct practice? > > Thank you > > -- > Mislav > _______________________________________________ > Rails-core mailing list > Rails-core@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails-core > > > _______________________________________________ > Rails-core mailing list > Rails-core@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails-core > > >-- Charles Oliver Nutter @ headius.blogspot.com JRuby Developer @ jruby.sourceforge.net Application Architect @ www.ventera.com _______________________________________________ Rails-core mailing list Rails-core@lists.rubyonrails.org http://lists.rubyonrails.org/mailman/listinfo/rails-core
On 13 jun 2006, at 18.08, Dr. Ernie Prabhakar wrote:> Much as I admire the kibibyte concept, I have never seen *anyone* > using this in real life. Ultimately, language is determined by > usage, not standards, and I think we need to bow to public opinion > in this case.Strongspace, a rails application, does: http://www.strongspace.com/ faqs#what-is-a-gib I don''t think we''ve ever heard anyone really complain about it, other than "it''s great you''re using the proper units". JS (my ~0.341 bytes) _______________________________________________ Rails-core mailing list Rails-core@lists.rubyonrails.org http://lists.rubyonrails.org/mailman/listinfo/rails-core
My vote: changing Numeric#kilobyte at this point will result in breakage. Thus, we can''t cause the existing kilo/mega/etc. methods to change. However, I think the unitless approach is worth investigating: Numeric#kilo #-> n*1_000 Numeric#mega #-> n*1_000_000 etc. - Jamis On Jun 13, 2006, at 12:43 PM, Johan Sorensen wrote:> > On 13 jun 2006, at 18.08, Dr. Ernie Prabhakar wrote: > >> Much as I admire the kibibyte concept, I have never seen *anyone* >> using this in real life. Ultimately, language is determined by >> usage, not standards, and I think we need to bow to public opinion >> in this case. > > Strongspace, a rails application, does: http://www.strongspace.com/ > faqs#what-is-a-gib > > I don''t think we''ve ever heard anyone really complain about it, > other than "it''s great you''re using the proper units". > > JS > (my ~0.341 bytes) > > _______________________________________________ > Rails-core mailing list > Rails-core@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails-core
Agreed - it doesn''t seem harmful to include aliases such that people *can* call kibibyte and get the correct result, or possibly even move the actual implementation into those new methods and redefine the kilo/mega methods as aliases*... However, changing the default behaviour of kilobyte and megabyte is going to a) drop-kick the principle of least surprise b) break stuff in potentially non-obvious ways By all means start the kibi revolution, but begin it with gentle re-education rather than sudden Numeric disruption. I suspect it may be a while before the world is ready to deal with tibibytes.... - james * or... write a plugin that defines the correct behaviour, and persuade people to love it. On 6/13/06, Jamis Buck <jamis@37signals.com> wrote:> My vote: changing Numeric#kilobyte at this point will result in > breakage. Thus, we can''t cause the existing kilo/mega/etc. methods to > change. > > However, I think the unitless approach is worth investigating: > > Numeric#kilo #-> n*1_000 > Numeric#mega #-> n*1_000_000 > etc. > > - Jamis > > On Jun 13, 2006, at 12:43 PM, Johan Sorensen wrote: > > > > > On 13 jun 2006, at 18.08, Dr. Ernie Prabhakar wrote: > > > >> Much as I admire the kibibyte concept, I have never seen *anyone* > >> using this in real life. Ultimately, language is determined by > >> usage, not standards, and I think we need to bow to public opinion > >> in this case. > > > > Strongspace, a rails application, does: http://www.strongspace.com/ > > faqs#what-is-a-gib > > > > I don''t think we''ve ever heard anyone really complain about it, > > other than "it''s great you''re using the proper units". > > > > JS > > (my ~0.341 bytes) > > > > _______________________________________________ > > Rails-core mailing list > > Rails-core@lists.rubyonrails.org > > http://lists.rubyonrails.org/mailman/listinfo/rails-core > > _______________________________________________ > Rails-core mailing list > Rails-core@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails-core >-- * J * ~
I think the alias idea is a good one. I have submitted a patch that does exactly that. http://dev.rubyonrails.org/ticket/5387 I wasn''t exactly sure what to do for the tests since they are just aliases, I just added copies of the existing numeric_ext_tests and changed kilo => kibi, etc. Please have a look, I think this is sufficient to fix this "problem" ~Jamie On Jun 13, 2006, at 3:42 PM, James Adam wrote:> Agreed - it doesn''t seem harmful to include aliases such that people > *can* call kibibyte and get the correct result, or possibly even move > the actual implementation into those new methods and redefine the > kilo/mega methods as aliases*... > > However, changing the default behaviour of kilobyte and megabyte is > going to > > a) drop-kick the principle of least surprise > b) break stuff in potentially non-obvious ways > > By all means start the kibi revolution, but begin it with gentle > re-education rather than sudden Numeric disruption. I suspect it may > be a while before the world is ready to deal with tibibytes.... > > - james > > * or... write a plugin that defines the correct behaviour, and > persuade people to love it. > > On 6/13/06, Jamis Buck <jamis@37signals.com> wrote: >> My vote: changing Numeric#kilobyte at this point will result in >> breakage. Thus, we can''t cause the existing kilo/mega/etc. methods to >> change. >> >> However, I think the unitless approach is worth investigating: >> >> Numeric#kilo #-> n*1_000 >> Numeric#mega #-> n*1_000_000 >> etc. >> >> - Jamis >> >> On Jun 13, 2006, at 12:43 PM, Johan Sorensen wrote: >> >> > >> > On 13 jun 2006, at 18.08, Dr. Ernie Prabhakar wrote: >> > >> >> Much as I admire the kibibyte concept, I have never seen *anyone* >> >> using this in real life. Ultimately, language is determined by >> >> usage, not standards, and I think we need to bow to public opinion >> >> in this case. >> > >> > Strongspace, a rails application, does: http://www.strongspace.com/ >> > faqs#what-is-a-gib >> > >> > I don''t think we''ve ever heard anyone really complain about it, >> > other than "it''s great you''re using the proper units". >> > >> > JS >> > (my ~0.341 bytes) >> > >> > _______________________________________________ >> > Rails-core mailing list >> > Rails-core@lists.rubyonrails.org >> > http://lists.rubyonrails.org/mailman/listinfo/rails-core >> >> _______________________________________________ >> Rails-core mailing list >> Rails-core@lists.rubyonrails.org >> http://lists.rubyonrails.org/mailman/listinfo/rails-core >> > > > -- > * J * > ~ > _______________________________________________ > Rails-core mailing list > Rails-core@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails-core
Seems like a change for change sake rather than something "common" people will actually use. Bob Silva http://i.nfectio.us/> -----Original Message----- > From: rails-core-bounces@lists.rubyonrails.org [mailto:rails-core- > bounces@lists.rubyonrails.org] On Behalf Of Jamie Quint > Sent: Tuesday, June 13, 2006 5:59 PM > To: rails-core@lists.rubyonrails.org > Subject: Re: [Rails-core] Are you a kilobyte or a kibibyte person? > > I think the alias idea is a good one. I have submitted a patch that > does exactly that. > > http://dev.rubyonrails.org/ticket/5387 > > I wasn''t exactly sure what to do for the tests since they are just > aliases, I just added copies of the existing numeric_ext_tests and > changed kilo => kibi, etc. Please have a look, I think this is > sufficient to fix this "problem" > > ~Jamie > > On Jun 13, 2006, at 3:42 PM, James Adam wrote: > > > Agreed - it doesn''t seem harmful to include aliases such that people > > *can* call kibibyte and get the correct result, or possibly even move > > the actual implementation into those new methods and redefine the > > kilo/mega methods as aliases*... > > > > However, changing the default behaviour of kilobyte and megabyte is > > going to > > > > a) drop-kick the principle of least surprise > > b) break stuff in potentially non-obvious ways > > > > By all means start the kibi revolution, but begin it with gentle > > re-education rather than sudden Numeric disruption. I suspect it may > > be a while before the world is ready to deal with tibibytes.... > > > > - james > > > > * or... write a plugin that defines the correct behaviour, and > > persuade people to love it. > > > > On 6/13/06, Jamis Buck <jamis@37signals.com> wrote: > >> My vote: changing Numeric#kilobyte at this point will result in > >> breakage. Thus, we can''t cause the existing kilo/mega/etc. methods to > >> change. > >> > >> However, I think the unitless approach is worth investigating: > >> > >> Numeric#kilo #-> n*1_000 > >> Numeric#mega #-> n*1_000_000 > >> etc. > >> > >> - Jamis > >> > >> On Jun 13, 2006, at 12:43 PM, Johan Sorensen wrote: > >> > >> > > >> > On 13 jun 2006, at 18.08, Dr. Ernie Prabhakar wrote: > >> > > >> >> Much as I admire the kibibyte concept, I have never seen *anyone* > >> >> using this in real life. Ultimately, language is determined by > >> >> usage, not standards, and I think we need to bow to public opinion > >> >> in this case. > >> > > >> > Strongspace, a rails application, does: http://www.strongspace.com/ > >> > faqs#what-is-a-gib > >> > > >> > I don''t think we''ve ever heard anyone really complain about it, > >> > other than "it''s great you''re using the proper units". > >> > > >> > JS > >> > (my ~0.341 bytes) > >> > > >> > _______________________________________________ > >> > Rails-core mailing list > >> > Rails-core@lists.rubyonrails.org > >> > http://lists.rubyonrails.org/mailman/listinfo/rails-core > >> > >> _______________________________________________ > >> Rails-core mailing list > >> Rails-core@lists.rubyonrails.org > >> http://lists.rubyonrails.org/mailman/listinfo/rails-core > >> > > > > > > -- > > * J * > > ~ > > _______________________________________________ > > Rails-core mailing list > > Rails-core@lists.rubyonrails.org > > http://lists.rubyonrails.org/mailman/listinfo/rails-core > > _______________________________________________ > Rails-core mailing list > Rails-core@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails-core
On 6/14/06, Jamie Quint <jsquintz@gmail.com> wrote:> > I think the alias idea is a good one. I have submitted a patch that > does exactly that. > > http://dev.rubyonrails.org/ticket/5387Jamie, Your patch has one fundamental flaw. Purists who would want to use kibibyte etc. to display sizes measured in base 2 units would sure be against kilobyte etc. measuring in base 2 units too. In other words, this is only half of the solution, and we are looking for a complete one. James: about drop-kicking the principle of least surprise - in my opinion, programmers who would be surprised to find out ''kilo'' means 1000 are the same who don''t exactly care about the precision. So I don''t think they are even going to notice. About the potential breakage: in my patch, there is a method (ActiveSupport::CoreExtensions::Numeric::Bytes.legacy_base) which makes good ol'' methods measure in base 2 units again. Folk who don''t want to roll with this change would put that in environment.rb, preventing breakage. About writing a plugin for this: sure I''m going to make a plugin out of my patch; I just need to set up a repository for this. But I never believed this was just some odd, wacky practice intented for rare people -- I believe this should be Rails core to raise awareness in current and (especially) next generations. Today, precision matters; Strongspace, some bittorent clients and trackers, and others all demonstrate this. _______________________________________________ Rails-core mailing list Rails-core@lists.rubyonrails.org http://lists.rubyonrails.org/mailman/listinfo/rails-core
On Jun 14, 2006, at 4:09 AM, Mislav Marohnić wrote:> On 6/14/06, Jamie Quint <jsquintz@gmail.com> wrote: > I think the alias idea is a good one. I have submitted a patch that > does exactly that. > > http://dev.rubyonrails.org/ticket/5387 > > Jamie, > > Your patch has one fundamental flaw. Purists who would want to use > kibibyte etc. to display sizes measured in base 2 units would sure > be against kilobyte etc. measuring in base 2 units too. In other > words, this is only half of the solution, and we are looking for a > complete one. > > James: about drop-kicking the principle of least surprise - in my > opinion, programmers who would be surprised to find out ''kilo'' > means 1000 are the same who don''t exactly care about the precision. > So I don''t think they are even going to notice. > > About the potential breakage: in my patch, there is a method > (ActiveSupport::CoreExtensions::Numeric::Bytes.legacy_base) which > makes good ol'' methods measure in base 2 units again. Folk who > don''t want to roll with this change would put that in > environment.rb, preventing breakage. > > About writing a plugin for this: sure I''m going to make a plugin > out of my patch; I just need to set up a repository for this. But I > never believed this was just some odd, wacky practice intented for > rare people -- I believe this should be Rails core to raise > awareness in current and (especially) next generations. Today, > precision matters; Strongspace, some bittorent clients and > trackers, and others all demonstrate this.Note that Strongspace and bittorent *display* the number as KiB, etc. You can still do that in Rails--the Numeric#kilobyte method is for programmers to call--it''s up to you to tell the user what the units are. Thus, there is nothing preventing you from saying, in a view: <%= size.kilobytes %> KiB But that''s not the issue that started all of this. What is under discussion right now is not displaying the "proper" units to the user, it is making a helper with with the "proper" name available to the developer. That said, the half-solution is sufficient. Is it necessary? I still have my doubts. For now, a plugin is the way to go. If it gains wide enough adoption, we can certainly consider adding to core. - Jamis
On 6/14/06, Jamis Buck <jamis@37signals.com> wrote:> > Note that Strongspace and bittorent *display* the number as KiB, etc. > You can still do that in Rails--the Numeric#kilobyte method is for > programmers to call--it''s up to you to tell the user what the units > are. Thus, there is nothing preventing you from saying, in a view: > > <%= size.kilobytes %> KiBRight, there is nothing preventing you and the calculation presented is absolutely correct. Just that most of the people wouldn''t write it like that; they would use a helper for this (that displays "KB"). So in fact this is encouraging developers to measure, speak and display in wrong units.> But that''s not the issue that started all of this. What is under > discussion right now is not displaying the "proper" units to the > user, it is making a helper with with the "proper" name available to > the developer.I admit that I may have used some wrong examples, but these things go together. In my opinion, proper names in the framework are fundamental to calculating and displaying values to users. I couldn''t write <%= size.kilobytes %> KiB as well as I couldn''t write $<%= price.to_euros %> The plugin is definitely coming this way. Until it comes it is either the patch or the half-patch for all of you who want to adopt this. Since I don''t have an SVN host available I would appreciate if someone would host it with me having commit rights to it. What about capitalization in the helper, "Bytes" and "KB"? Might at least this be corrected without needing a plugin? Thank you all who submitted your opinions on this subject, Mislav
**On Jun 14, 2006, at 3:09 AM, Mislav Marohnić wrote:> Your patch has one fundamental flaw. Purists who would want to use > kibibyte etc. to display sizes measured in base 2 units would sure > be against kilobyte etc. measuring in base 2 units too. In other > words, this is only half of the solution, and we are looking for a > complete one.I realize that my solution didn''t solve the "problem", I didn''t provide a "complete" solution because if kilobytes changed to base 10, for many people that would be something very unexpected and confusing. Regardless of what the actual correct method of representation is, most people consider a kilobyte to be 1024 bytes. **On Jun 14, 2006, at 7:11 AM, Jamis Buck wrote:> For now, a plugin is the way to go. If it gains wide enough > adoption, we can certainly consider adding to core.That makes sense for now, ticket closed. ~Jamie _______________________________________________ Rails-core mailing list Rails-core@lists.rubyonrails.org http://lists.rubyonrails.org/mailman/listinfo/rails-core