RE: underscores vs hyphens (was Re: A new era for Temporal)

2010-04-11 Thread Conrad Schneiker
 From: Mark J. Reed [mailto:markjr...@gmail.com]
[...]
 Perl borrows vocabulary almost exclusively from English, but it is
 not English, and its conventions are not those of English.  (And the
 conventions around hyphens that people are citing are quite specifically
 those of standard written English; other writing systems, even those using
 the same alphabet and mostly the same punctuation, have different rules).

Consider s/English/Linux/ for example. :-)

One consideration leading up to allowing - in P6 identifiers (initially in 
the context of an optional syntax-tweaking module) involved compatibility with 
fairly common usage in {directory and file} names (where spaces are avoided for 
cross-platform reasons). I've always thought {Lisp variable names and 
Unix/Linux file names} with hyphens (versus underscores) were {more readable 
and substantially easier to type (during long typing sessions)}. 

http://groups.google.com/group/perl.perl6.language/browse_thread/thread/1625baa7eead0d71/

http://groups.google.com/group/perl.perl6.compiler/browse_thread/thread/e6cc5dc9360ada36/c59f2fb1f49b80f5?lnk=gstq=r28689#c59f2fb1f49b80f5
 

 I would personally like to see hyphens used as the standard word separator,
 with underscores available for exceptions - say, naming a Perl interface
 method exactly the same as the underlying C function it provides access to.
[...]

++!

Best regards,
Conrad

Conrad Schneiker
www.AthenaLab.com




Re: r30357 - docs/Perl6/Spec/S32-setting-library

2010-04-11 Thread Jon Lang
 Log:
 [Numeric] Move sqrt to Numeric. Remove incorrect return value type of roots.  
 Move cis and unpolar to Real.  Add to-radians and from-radians to Numeric.

The return value for roots should have been corrected (to List of
Numeric), not removed.

-- 
Jonathan Dataweaver Lang


Re: underscores vs hyphens (was Re: A new era for Temporal)

2010-04-11 Thread Sundara Raman
On Sun, Apr 11, 2010 at 4:47 AM, Damian Conway dam...@conway.org wrote:

 And is it really so hard to teach: use underscore by default and reserve
 hyphens for between a noun and its adjective? Perhaps it *is*, but
 then that's a very sad reflection on our profession.


If anything, it's a sad reflection on humanity. I don't see any special
reason that our profession should be an exception to Sturgeon's law.

And, IMHO, conventions should be such that every Joe-Coder should to be able
to understand and use them, which means they should be as simple as
possible. This thread itself proves that the choice of places where hyphen
and underscore should be used under this scheme *feels* ambiguous, even if
it strictly isn't so.

I believe it would be best to have a rule for hyphen-or-underscore that can
be mechanically applied. This would enable a perl6critic tool to check its
proper usage, and more importantly, make the choice easy for Joe-Coder since
he does not like to think much about function names.

With such conventions, it is important to cater to mere mortals, since their
code would form the bulk, which means a misunderstanding on their part would
make their 'convention' the popular one, which is probably not a good thing.
We might end up with PHP-ish nightmare of mixed conventions in function
naming.

I might go so far as to say that we could drop underscores altogether, and
embrace the Lispy way of using hyphens everywhere. Easier to type, looks
good, and simple to apply.

My 2c,
Sundar

-- 
! Knowing others is intelligence; knowing yourself is true wisdom. Mastering
others is strength; mastering yourself is true power.
! If you realize that you have enough, you are truly rich.


Re: underscores vs hyphens (was Re: A new era for Temporal)

2010-04-11 Thread Jonathan Scott Duff
On Sat, Apr 10, 2010 at 5:14 AM, Mark J. Reed markjr...@gmail.com wrote:

 I'd much rather see a single consistent style throughout the setting
 than backwards compatibility with p5 naming conventions.

 If Temporal is the first setting module to use multiword identifiers,
 I vote for hyphens.


As another data point ... me too.  I'd prefer to see hyphens than
underscores.

-Scott


 They're easier on the fingers and the eyes;
 underscores have always felt like an ugly compromise to make the
 compiler's job easier.

 On Saturday, April 10, 2010, Carl Mäsak cma...@gmail.com wrote:
  John ():
  Forgive me if this is a question the reveals how poorly I've been
  following Perl 6 development, but what's the deal with some methods
  using hyphen-separated words (e.g., day-of-week) while others use
  normal Perl method names (e.g., set_second)?
 
  I'd just like to point out that the current Temporal spec only does
  methods with underscores, including Cday_of_week.
 
  This goes against my personal preferences; I greatly prefer dashes in
  almost all of the code I write. But I acknowledge that most of the
  programmers out there seem to expect underscores -- and also, the aim
  was to produce a small delta from CPAN's DateTime and not change
  around things ad lib.
 
  // Carl
 

 --
 Mark J. Reed markjr...@gmail.com



Re: underscores vs hyphens (was Re: A new era for Temporal)

2010-04-11 Thread Damian Conway
Well, if we're not going to try to implement linguistically based
hyphenation/underscoriation rules (and I'd still argue that hyphenating
adjectives to nouns and underscoring everything else isn't exactly
rocket science), then I'd suggest we reconsider a radically different
proposal that was made on this list five years ago:

http://www.mail-archive.com/perl6-language@perl.org/msg22675.html

The relevant suggestion regarding hyphens vs underscores is:

...to allow both characters, but have them mean the same thing.

That is, any isolated internal underscore can be replaced with an
isolated internal hyphen (and vice versa), without changing the meaning
of the identifier.

This would be the death of fine distinctions such as between:

activate_main-sequence_detonator();

and:

activate_main_sequence-detonator();

which would now resolve to the same subroutine...and do so even if
that subroutine had been declared as

sub activate-main-sequence-detonator {...}

But perhaps such distinctions are indeed too fine and subtle, and we
would be better off eliminating the possibility of them entirely.

Hyphen/underscore equivalence would allow those (apparently elite few) who
can correctly use a hyphen to correctly use the hyphen, whilst the
shambling masses can just randomly type underscores or hyphens between
each word, as their atavistic whims dictate.

;-)

Damian


Re: A new era for Temporal

2010-04-11 Thread Moritz Lenz
Dave Rolsky wrote:
 On Thu, 8 Apr 2010, Carl Mäsak wrote:
 
 I do want to explicitly credit Dave Rolsky, whose work on the DateTime
 family of modules on CPAN has informed much of the current spec,
 sometimes to the point of verbatim copying.
 
 Thanks, but I'd hate to see you copy all my mistakes too!
 
 One thing I think is really important is to offer a Date-only object 
 without a time component.
 
 The lack of such an object in Perl 5's DateTime family is a real problem. 
 If you're only interested in dates and date math, time and time zones just 
 muddies the water.

I've now written such a module:

http://github.com/moritz/Date

It mostly works with Rakudo, except it doesn't yet export the overloaded
operators because of
http://rt.perl.org/rt3/Ticket/Display.html?id=74104. Some minor
features (like the today() constructor) are not yet implemented.

It is very much inspired by Date::Simple on CPAN. There's no
documentation yet, but the tests pretty much define the behavior.

I've planned to add such a module to the Perl 6 spec, but some comments
on #perl6 suggested it should be kept out of core to prevent bloat.
Still if the overall opinion is that Perl 6 should have such a module
out of the box, I'll be happy to spec it.


Cheers,
Moritz


Re: underscores vs hyphens (was Re: A new era for Temporal)

2010-04-11 Thread Geoffrey Broadwell
On Sat, 2010-04-10 at 17:20 -0700, yary wrote:
 Adjectives and nouns aren't English-only. So Damian's proposal is
 multi-culti. One could argue that Perl's identifiers, keywords, etc
 are based on English so that it is more difficult for a non-English
 speaker to discern why underscore is used in some places and hyphens
 in other. The solution to that would be rote memorization of method
 names, including _ and - in the spelling. Not ideal, but most
 likely what many English speaking programmers would do too. And would
 cuss over.

And there's the rub for me.  One of the goals of Perl 6 is to reduce the
amount of rote memorization of special cases that Perl 5 required.  Any
mixed use of _ and - in the standard setting defies that goal.

(FWIW, I don't really care which is used -- I see arguments for both --
but I do firmly believe the standard setting should only use one or the
other.  Damian's Temporal example in which only one method used a
different separator made the rules-versus-exceptions part of my brain
scream for mercy.)


-'f




Re: underscores vs hyphens (was Re: A new era for Temporal)

2010-04-11 Thread John Siracusa
On Sun, Apr 11, 2010 at 10:54 AM, Damian Conway dam...@conway.org wrote:
 Hyphen/underscore equivalence would allow those (apparently elite few) who
 can correctly use a hyphen to correctly use the hyphen

That's about the only advantage of this scheme that I can think of.
The disadvantages, which affect everyone, are many and bigger:
search/replace headaches, novice confusion, adding to Perl's syntax
infamy, etc.

(Besides, I'm sure you can Acme::-up something that implements this
scheme in Perl 6 for your own devious purposes anyway… ;)

-John


Re: underscores vs hyphens (was Re: A new era for Temporal)

2010-04-11 Thread Mark J. Reed
Egad, no to the equivalence.  We'd be back in
case-insensitive-language land, only without the benefit of even that
dubious tradition.

And at least for me, the beef with mixing hyphens and underscores is
not that the great unwashed masses can't handle it, but that there
will inevitably be cases where even the elite rocket surgeons in their
ivory control towers can't agree on which is correct.  It's less
too subtle for JAPH and more too subtle for consensus even among
the cognoscenti..  The edge cases would be back to rote memorization.

On Sunday, April 11, 2010, John Siracusa sirac...@gmail.com wrote:
 On Sun, Apr 11, 2010 at 10:54 AM, Damian Conway dam...@conway.org wrote:
 Hyphen/underscore equivalence would allow those (apparently elite few) who
 can correctly use a hyphen to correctly use the hyphen

 That's about the only advantage of this scheme that I can think of.
 The disadvantages, which affect everyone, are many and bigger:
 search/replace headaches, novice confusion, adding to Perl's syntax
 infamy, etc.

 (Besides, I'm sure you can Acme::-up something that implements this
 scheme in Perl 6 for your own devious purposes anyway… ;)

 -John


-- 
Mark J. Reed markjr...@gmail.com


Re: underscores vs hyphens (was Re: A new era for Temporal)

2010-04-11 Thread Matthew
I can't help but agree with Damian. I don't see much of a point in 
making a distinction between - and _.


More specifically, if a user were to define a function (say, 
i-hate-camel-case()), it would not be good to let them be the same. 
Readability would suffer when examining someone's code and you see 
i_hate_camel_case() and you can't find that function (in my example 
there are 8 different possibilities for what the actual function was 
defined as!)


However, in core functionality, such a distinction should be made /if 
it makes sense/. For example, allowing 3 _ 4 in place of 3 - 4 would not 
make sense, while obscure commands (the PIR functions in rakudo, for 
example), would do better to not be so stringent (or at least tell you 
what you did wrong).


This is my best guess based on what I know. I don't know the whole 
story, and I'm always ready to be convinced otherwise.


--
Don't Panic!



Re: underscores vs hyphens (was Re: A new era for Temporal)

2010-04-11 Thread Mark J. Reed
Egad, no to the equivalence.  We'd be back in
case-insensitive-language land, only without the benefit of even that
dubious tradition.

And at least for me, the beef with mixing hyphens and underscores is
not that the great unwashed masses can't handle it, but that there
will inevitably be cases where even the elite rocket surgeons in their
ivory control towers can't agree on which is correct.  It's less
too subtle for JAPH and more too subtle for consensus even among
the cognoscenti..  The edge cases would be back to rote memorization.

On Sunday, April 11, 2010, John Siracusa sirac...@gmail.com wrote:
 On Sun, Apr 11, 2010 at 10:54 AM, Damian Conway dam...@conway.org wrote:
 Hyphen/underscore equivalence would allow those (apparently elite few) who
 can correctly use a hyphen to correctly use the hyphen

 That's about the only advantage of this scheme that I can think of.
 The disadvantages, which affect everyone, are many and bigger:
 search/replace headaches, novice confusion, adding to Perl's syntax
 infamy, etc.

 (Besides, I'm sure you can Acme::-up something that implements this
 scheme in Perl 6 for your own devious purposes anyway… ;)

 -John


-- 
Mark J. Reed markjr...@gmail.com


Re: underscores vs hyphens (was Re: A new era for Temporal)

2010-04-11 Thread Shawn H Corey

Damian Conway wrote:

Well, if we're not going to try to implement linguistically based
hyphenation/underscoriation rules (and I'd still argue that hyphenating
adjectives to nouns and underscoring everything else isn't exactly
rocket science), then I'd suggest we reconsider a radically different
proposal that was made on this list five years ago:

http://www.mail-archive.com/perl6-language@perl.org/msg22675.html

The relevant suggestion regarding hyphens vs underscores is:

...to allow both characters, but have them mean the same thing.


I was about to say that if hyphens and underscores mean the same thing, 
then why are Perl 6's identifiers case sensitive?  But, you know what, I 
haven't found any documentation stating they are.  Could someone please 
give me the URI in the official documentation where this is stated.  Thanks.



--
Just my 0.0002 million dollars worth,
  Shawn

Programming is as much about organization and communication
as it is about coding.

I like Perl; it's the only language where you can bless your
thingy.

Eliminate software piracy:  use only FLOSS.


Re: underscores vs hyphens (was Re: A new era for Temporal)

2010-04-11 Thread Darren Duncan

Damian Conway wrote:

The relevant suggestion regarding hyphens vs underscores is:

...to allow both characters, but have them mean the same thing.

That is, any isolated internal underscore can be replaced with an
isolated internal hyphen (and vice versa), without changing the meaning
of the identifier.


I am formally opposed to this idea.  I see that making underscores and hyphens 
to be equivalent is akin to having case-insensitive identifiers, where 
Perl,PERL,perl mean the same thing.  Rather what I want is to be 
everything-sensitive, as AFAIK Perl 6 currently is; if something looks 
different, it is different. -- Darren Duncan


Re: underscores vs hyphens (was Re: A new era for Temporal)

2010-04-11 Thread Daniel Ruoso
Em Dom, 2010-04-11 às 07:54 -0700, Damian Conway escreveu:
 The relevant suggestion regarding hyphens vs underscores is:
 ...to allow both characters, but have them mean the same thing.

er... this smells like :: and ' in Perl 5... Which, while I find
Acme::Don't amusing, cannot be stated as sane design...

daniel



Re: A new era for Temporal

2010-04-11 Thread Dave Rolsky

On Sun, 11 Apr 2010, Moritz Lenz wrote:


I've planned to add such a module to the Perl 6 spec, but some comments
on #perl6 suggested it should be kept out of core to prevent bloat.
Still if the overall opinion is that Perl 6 should have such a module
out of the box, I'll be happy to spec it.


I think that having a standard, minimal API for this defined in core as a 
Date role would be ideal.



-dave

/*
http://VegGuide.org   http://blog.urth.org
Your guide to all that's veg  House Absolute(ly Pointless)
*/


Re: expression of seconds (was Re: A new era for Temporal)

2010-04-11 Thread Dave Rolsky

On Fri, 9 Apr 2010, Darren Duncan wrote:

conceptual and a usability and a math point of view.  If users only want the 
integer value, then they can just store the second as an integer in the first 
place.  As for the name, well whole_second can be made shorter, or its


Users will not always control how the DateTime object is constructed. 
Nonetheless, when they want to know what is the value for seconds, I 
think _most_ users will want an integer, not a floating point number.



-dave

/*
http://VegGuide.org   http://blog.urth.org
Your guide to all that's veg  House Absolute(ly Pointless)
*/


Re: underscores vs hyphens (was Re: A new era for Temporal)

2010-04-11 Thread Dave Rolsky

On Sat, 10 Apr 2010, Mark J. Reed wrote:


I'd much rather see a single consistent style throughout the setting
than backwards compatibility with p5 naming conventions.


Ditto!

If Perl 6 style is hyphens, use hyphens everywhere. That transition from 
P5 DateTime to P6 will then be a simple s/_/-/g



-dave

/*
http://VegGuide.org   http://blog.urth.org
Your guide to all that's veg  House Absolute(ly Pointless)
*/


Re: underscores vs hyphens (was Re: A new era for Temporal)

2010-04-11 Thread Doug McNutt
${A-1} = 3.14159;
$A = $A-1;
$A = $A -1;
$A-=2;
$A = 123E-2;
$A = Pi();
$B = sin ($A-1);
$B = sin (${A}-1);
$B = sin($A -1);

-2**2 = -4 except when it comes out +4 as in MS Excel.
_2**2 = +4 in some other languages that use _ as a unary minus operator.

Will editors be bothered when I try to include - in the list of characters 
that are considered words when double clicking? When doing a find and replace 
all as words?

Is the unicode equivalent of nbsp; allowed in a variable name?

-- 
-- Give me liberty or give me Obamacare --


Re: underscores vs hyphens (was Re: A new era for Temporal)

2010-04-11 Thread Darren Duncan

Doug McNutt wrote:

${A-1} = 3.14159;
$A = $A-1;
$A = $A -1;
$A-=2;
$A = 123E-2;
$A = Pi();
$B = sin ($A-1);
$B = sin (${A}-1);
$B = sin($A -1);

-2**2 = -4 except when it comes out +4 as in MS Excel.
_2**2 = +4 in some other languages that use _ as a unary minus operator.

Will editors be bothered when I try to include - in the list of characters 
that are considered words when double clicking? When doing a find and replace all as 
words?

Is the unicode equivalent of nbsp; allowed in a variable name?


See http://perlcabal.org/syn/S02.html#Names for your answers.

Essentially, I believe that any character at all is allowed in a variable name. 
 Its just that for most characters, when you use them the variable name has to 
be quoted.  The common unquoted identifier syntax is much more limited, and is 
mainly what was being discussed here.


-- Darren Duncan