Re: Possibility of standardized sprintf() in ES4?

2007-10-28 Thread Brendan Eich
On Oct 28, 2007, at 4:39 PM, Dan Scott wrote:

 Ah, fabulous - it seems that although the term sprintf appears in  
 the wiki, it's highlighted and therefore doesn't turn up in a  
 search for the term. And I was too dumb to search for string  
 format -- thanks for letting me know that the issue had been  
 raised in the past and that there had been some discussion about it.

I'm not sure the wiki search indexing is working correctly atm. We'll  
look into it.

 In my view, it's simply a gap in the standard library (and I  
 apologize if this was not the correct forum to raise concerns about  
 the standard library vs. the core language spec).

No worries, for better or worse, ECMA-262 specifies both core  
language and standard library.

 As I noted at the outset, there are a wide variety of sprintf()  
 (and probably String.format()) implementations already out in the  
 wild under various licenses and with varying sophistication. I  
 believe that adding such a method to the standard library would  
 help simplify the current situation and increase the ease of  
 reusing code between projects.

But which one? Whose ox gets gored? What about l10n? Etc.

You can tell we didn't have the bandwidth to take this on, and with  
so many JS libs purveying variations on a theme, we chose the virtue  
of not committing the standard to one particular string formatting  
library. But no matter the timing, having a concrete proposal would  
help. Can you link to the Microsoft String.format API doc?
/be
___
Es4-discuss mailing list
Es4-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es4-discuss


RE: Possibility of standardized sprintf() in ES4?

2007-10-16 Thread Samuel R. Neff

I would be all for .NET's String.Format() style of formatting.  Adobe Flex
provides a similar method in StringUtil.substitute() which provides ordered
substitution using the same {0} and {1} style tokens, but doesn't have any
formatting.

Sam

---
We're Hiring! Seeking a passionate developer to join our team building Flex
based products. Position is in the Washington D.C. metro area. If interested
contact [EMAIL PROTECTED]
 
-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of zwetan
Sent: Monday, October 15, 2007 5:51 PM
To: Dan Scott
Cc: es4-discuss@mozilla.org
Subject: Re: Possibility of standardized sprintf() in ES4?

Hi,

...

 Is there any other interest in adding a native sprintf() (probably as
 String.sprintf()) to the ES4 specs?


I'm interested in string formating, but surely not sprintf
I don't find it intuitive at all

I prefer something closer to String.format from .NET
but more dynamic and being able to use sort of tokens
like the ones you can use with E4X (node{token}/node)

see here for an implementation
http://maashaack.googlecode.com/svn/trunk/ES4a/src/system/Strings.as
( public static function format( format:String, ...args ):String )

cheers,
zwetan
___
Es4-discuss mailing list
Es4-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es4-discuss

___
Es4-discuss mailing list
Es4-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es4-discuss


Re: Possibility of standardized sprintf() in ES4?

2007-10-16 Thread Alex Russell
[ snip ]

 Sure. From what I can see of the Microsoft documentation a
 standardized String.format() function would meet the need for a
 standardized way of formatting a string just as well as a method
 based on C/Perl/PHP/Ruby sprintf() and Python's native string
 formatting, where named parameters are used instead of positional
 parameters.

Python allows both, and I prefer that style.

 Assuming there are no intellectual property concerns with adopting
 Microsoft's specification for this method, it would satisfy my use
 case for a string formatting method that accepts explicit positional
 or named parameters in support of internationalized text. I would
 simply be delighted if ES4 saved me and others from having to roll
 our own string formatter classes!

Eh, just go w/ Python's. It's more flexible, feels more like printf 
if/when you need it to, and can be used in the .NET-ish way.

Regards

-- 
Alex Russell
[EMAIL PROTECTED] A99F 8785 F491 D5FD 04D7 ACD9 4158 FFDF 2894 6876
[EMAIL PROTECTED] BE03 E88D EABB 2116 CC49 8259 CF78 E242 59C3 9723


pgp3LKURV6n3e.pgp
Description: PGP signature
___
Es4-discuss mailing list
Es4-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es4-discuss


Possibility of standardized sprintf() in ES4?

2007-10-15 Thread Dan Scott
Hello:

I've been working on a project requiring i18n support in ES
(http://open-ils.org), and it's become clear that a standard sprintf()
implementation in ES would have been very useful. There are currently
some open-source sprintf() implementations written in ES, but all of
the ones I've looked at so far seem to either have unusual licenses or
incomplete implementations (positional specifier support is absolutely
necessary for i18n, for example.)
http://hexmen.com/blog/2007/03/printf-sprintf/ is probably the closest
thing I've found to a solution yet.

For something as basic as string formatting, it would be great to be
able to count on a core implementation of sprintf() (or something
equivalent) in a future version of ES. Jon Udell made a comment to the
effect that string formatting was a part of the TG1 wiki at
http://weblogs.mozillazine.org/roadmap/archives/2006/02/js_and_python_news.html,
but I've been unable to find that section in the wiki (unless that is
limited strictly to String.replace()).

Is there any other interest in adding a native sprintf() (probably as
String.sprintf()) to the ES4 specs?

-- 
Dan Scott
Laurentian University
___
Es4-discuss mailing list
Es4-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es4-discuss


Re: Possibility of standardized sprintf() in ES4?

2007-10-15 Thread P T Withington
I would be very interested in this.  Have a look at our  
implementation (not called sprintf, but has similar goals).  Our  
implementation has an additional goal of keeping an association  
between the result string and the objects it represents.  Being a  
dynamic language, I think es4 should aspire to more than just C sprintf.

http://svn.openlaszlo.org/openlaszlo/trunk/WEB-INF/lps/lfc/compiler/ 
LzFormatter.lzs

Our source is licensed under CPL.

http://svn.openlaszlo.org/openlaszlo/trunk/LICENSE.txt

On 2007-10-15, at 08:27 EDT, Dan Scott wrote:

 Hello:

 I've been working on a project requiring i18n support in ES
 (http://open-ils.org), and it's become clear that a standard sprintf()
 implementation in ES would have been very useful. There are currently
 some open-source sprintf() implementations written in ES, but all of
 the ones I've looked at so far seem to either have unusual licenses or
 incomplete implementations (positional specifier support is absolutely
 necessary for i18n, for example.)
 http://hexmen.com/blog/2007/03/printf-sprintf/ is probably the closest
 thing I've found to a solution yet.

 For something as basic as string formatting, it would be great to be
 able to count on a core implementation of sprintf() (or something
 equivalent) in a future version of ES. Jon Udell made a comment to the
 effect that string formatting was a part of the TG1 wiki at
 http://weblogs.mozillazine.org/roadmap/archives/2006/02/ 
 js_and_python_news.html,
 but I've been unable to find that section in the wiki (unless that is
 limited strictly to String.replace()).

 Is there any other interest in adding a native sprintf() (probably as
 String.sprintf()) to the ES4 specs?

 -- 
 Dan Scott
 Laurentian University
 ___
 Es4-discuss mailing list
 Es4-discuss@mozilla.org
 https://mail.mozilla.org/listinfo/es4-discuss

___
Es4-discuss mailing list
Es4-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es4-discuss


Re: Possibility of standardized sprintf() in ES4?

2007-10-15 Thread zwetan
Hi,

...

 Is there any other interest in adding a native sprintf() (probably as
 String.sprintf()) to the ES4 specs?


I'm interested in string formating, but surely not sprintf
I don't find it intuitive at all

I prefer something closer to String.format from .NET
but more dynamic and being able to use sort of tokens
like the ones you can use with E4X (node{token}/node)

see here for an implementation
http://maashaack.googlecode.com/svn/trunk/ES4a/src/system/Strings.as
( public static function format( format:String, ...args ):String )

cheers,
zwetan
___
Es4-discuss mailing list
Es4-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es4-discuss


Re: Possibility of standardized sprintf() in ES4?

2007-10-15 Thread ekameleon
Hello :)

Yes i prefere too the Strings.format implementation :)  For me it's an
important feature and can be insert in the core String methods :)

EKA+ :)

2007/10/15, zwetan [EMAIL PROTECTED]:

 Hi,

 ...
 
  Is there any other interest in adding a native sprintf() (probably as
  String.sprintf()) to the ES4 specs?
 

 I'm interested in string formating, but surely not sprintf
 I don't find it intuitive at all

 I prefer something closer to String.format from .NET
 but more dynamic and being able to use sort of tokens
 like the ones you can use with E4X (node{token}/node)

 see here for an implementation
 http://maashaack.googlecode.com/svn/trunk/ES4a/src/system/Strings.as
 ( public static function format( format:String, ...args ):String )

 cheers,
 zwetan
 ___
 Es4-discuss mailing list
 Es4-discuss@mozilla.org
 https://mail.mozilla.org/listinfo/es4-discuss

___
Es4-discuss mailing list
Es4-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es4-discuss


Re: Possibility of standardized sprintf() in ES4?

2007-10-15 Thread Dan Scott
On 15/10/2007, ekameleon [EMAIL PROTECTED] wrote:

 Hello :)

 Yes i prefere too the Strings.format implementation :)  For me it's an
 important feature and can be insert in the core String methods :)

 EKA+ :)

 2007/10/15, zwetan [EMAIL PROTECTED]:
 
  Hi,
 
  ...
  
   Is there any other interest in adding a native sprintf() (probably as
   String.sprintf()) to the ES4 specs?
  
 
  I'm interested in string formating, but surely not sprintf
  I don't find it intuitive at all
 
  I prefer something closer to String.format from .NET
  but more dynamic and being able to use sort of tokens
  like the ones you can use with E4X (node{token}/node)
 
  see here for an implementation
  http://maashaack.googlecode.com/svn/trunk/ES4a/src/system/Strings.as
  ( public static function format( format:String, ...args ):String )
 
  cheers,
  zwetan
  ___
  Es4-discuss mailing list
  Es4-discuss@mozilla.org
  https://mail.mozilla.org/listinfo/es4-discuss
 


 ___
 Es4-discuss mailing list
 Es4-discuss@mozilla.org
 https://mail.mozilla.org/listinfo/es4-discuss


Sure. From what I can see of the Microsoft documentation a standardized
String.format() function would meet the need for a standardized way of
formatting a string just as well as a method based on C/Perl/PHP/Ruby
sprintf() and Python's native string formatting, where named parameters are
used instead of positional parameters.

Assuming there are no intellectual property concerns with adopting
Microsoft's specification for this method, it would satisfy my use case for
a string formatting method that accepts explicit positional or named
parameters in support of internationalized text. I would simply be delighted
if ES4 saved me and others from having to roll our own string formatter
classes!

-- 
Dan Scott
Laurentian University
___
Es4-discuss mailing list
Es4-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es4-discuss