Re: Naming conventions for functions in similar modules

2011-06-23 Thread Andrej Mitrovic
On 6/23/11, SimonM wrote: > Oh! Forgot about this: > import ascii = std.ascii; This doesn't help with std.string, because you'll inadvertently hide the string type: import string = std.string; // woops void main() { string x; } Error: module std.string is used as a type

Re: Naming conventions for functions in similar modules

2011-06-23 Thread Kagamin
Andrej Mitrovic Wrote: >> Did you try renamed imports? > >I guess that could work. I'm forgetting how many features we have in D. :p Huh, even C# has them, though usings there work rather like aliases. Can you alias a module in D?

Re: Naming conventions for functions in similar modules

2011-06-23 Thread Andrei Alexandrescu
On 6/23/11 2:58 AM, SimonM wrote: On 2011/06/23 00:22 AM, SimonM wrote: On 2011/06/22 19:16 PM, Andrei Alexandrescu wrote: On 6/22/11 11:53 AM, Walter Bright wrote: On 6/22/2011 4:47 AM, Lars T. Kyllingstad wrote: One problem: std.uni only contains functions for dealing with upper/ lower case

Re: Naming conventions for functions in similar modules

2011-06-23 Thread SimonM
On 2011/06/23 00:22 AM, SimonM wrote: On 2011/06/22 19:16 PM, Andrei Alexandrescu wrote: On 6/22/11 11:53 AM, Walter Bright wrote: On 6/22/2011 4:47 AM, Lars T. Kyllingstad wrote: One problem: std.uni only contains functions for dealing with upper/ lower case and for checking whether something

Re: Naming conventions for functions in similar modules

2011-06-22 Thread SimonM
On 2011/06/22 19:16 PM, Andrei Alexandrescu wrote: On 6/22/11 11:53 AM, Walter Bright wrote: On 6/22/2011 4:47 AM, Lars T. Kyllingstad wrote: One problem: std.uni only contains functions for dealing with upper/ lower case and for checking whether something is an alpha character. If you want the

Re: Naming conventions for functions in similar modules

2011-06-22 Thread Jonathan M Davis
On 2011-06-22 14:06, Jonathan M Davis wrote: > On 2011-06-22 13:30, Lars T. Kyllingstad wrote: > > On Wed, 22 Jun 2011 09:53:39 -0700, Walter Bright wrote: > > > On 6/22/2011 4:47 AM, Lars T. Kyllingstad wrote: > > >> One problem: std.uni only contains functions for dealing with upper/ > > >> lower

Re: Naming conventions for functions in similar modules

2011-06-22 Thread Jonathan M Davis
On 2011-06-22 13:30, Lars T. Kyllingstad wrote: > On Wed, 22 Jun 2011 09:53:39 -0700, Walter Bright wrote: > > On 6/22/2011 4:47 AM, Lars T. Kyllingstad wrote: > >> One problem: std.uni only contains functions for dealing with upper/ > >> lower case and for checking whether something is an alpha ch

Re: Naming conventions for functions in similar modules

2011-06-22 Thread Jonathan M Davis
On 2011-06-22 13:34, Timon Gehr wrote: > Lars T. Kyllingstad wrote: > > On Wed, 22 Jun 2011 09:53:39 -0700, Walter Bright wrote: > >> On 6/22/2011 4:47 AM, Lars T. Kyllingstad wrote: > >>> One problem: std.uni only contains functions for dealing with upper/ > >>> lower case and for checking whether

Re: Naming conventions for functions in similar modules

2011-06-22 Thread Timon Gehr
Lars T. Kyllingstad wrote: > On Wed, 22 Jun 2011 09:53:39 -0700, Walter Bright wrote: > >> On 6/22/2011 4:47 AM, Lars T. Kyllingstad wrote: >>> One problem: std.uni only contains functions for dealing with upper/ >>> lower case and for checking whether something is an alpha character. >>> If you w

Re: Naming conventions for functions in similar modules

2011-06-22 Thread Lars T. Kyllingstad
On Wed, 22 Jun 2011 09:53:39 -0700, Walter Bright wrote: > On 6/22/2011 4:47 AM, Lars T. Kyllingstad wrote: >> One problem: std.uni only contains functions for dealing with upper/ >> lower case and for checking whether something is an alpha character. >> If you want the other functions, such as

Re: Naming conventions for functions in similar modules

2011-06-22 Thread bearophile
Andrei: > One improvement would be to relax package lookup such that > ascii.tolower() is a synonym for std.ascii.tolower. That way everything > works reasonably nice out of the box. Every time you mud the semantics for a little convenience, later something will come to bite your rump. Shortcu

Re: Naming conventions for functions in similar modules

2011-06-22 Thread KennyTM~
On Jun 23, 11 01:16, Andrei Alexandrescu wrote: On 6/22/11 11:53 AM, Walter Bright wrote: On 6/22/2011 4:47 AM, Lars T. Kyllingstad wrote: One problem: std.uni only contains functions for dealing with upper/ lower case and for checking whether something is an alpha character. If you want the ot

Re: Naming conventions for functions in similar modules

2011-06-22 Thread so
On Wed, 22 Jun 2011 20:16:43 +0300, Andrei Alexandrescu wrote: One improvement would be to relax package lookup such that ascii.tolower() is a synonym for std.ascii.tolower. That way everything works reasonably nice out of the box. Andrei I suggested that on another reply but there is

Re: Naming conventions for functions in similar modules

2011-06-22 Thread Andrej Mitrovic
Also, I've found yet another with bug: import std.stdio; static import std.string; void main() { with (std.string) writeln(entab("")); } OPTLINK (R) for Win32 Release 8.00.12 Copyright (C) Digital Mars 1989-2010 All rights reserved. http://www.digitalmars.com/ctg/optlink.html C:\DOCUME

Re: Naming conventions for functions in similar modules

2011-06-22 Thread Andrej Mitrovic
On 6/22/11, Andrei Alexandrescu wrote: > One improvement would be to relax package lookup such that > ascii.tolower() is a synonym for std.ascii.tolower. That way everything > works reasonably nice out of the box. What would help is if the with statement could be used like an attribute. Currently

Re: Naming conventions for functions in similar modules

2011-06-22 Thread Andrei Alexandrescu
On 6/22/11 11:53 AM, Walter Bright wrote: On 6/22/2011 4:47 AM, Lars T. Kyllingstad wrote: One problem: std.uni only contains functions for dealing with upper/ lower case and for checking whether something is an alpha character. If you want the other functions, such as isDigit(), isPunctuation()

Re: Naming conventions for functions in similar modules

2011-06-22 Thread Chris Molozian
I'm mostly a listener on the mailing list but I very much agree with Walter. Personally I think arguments about typing length are daft in an age with IDEs and language tooling. The most important aspect of the naming convention IMHO is readability and intuitiveness. I like the idea of naming th

Re: Naming conventions for functions in similar modules

2011-06-22 Thread Walter Bright
On 6/22/2011 4:47 AM, Lars T. Kyllingstad wrote: One problem: std.uni only contains functions for dealing with upper/ lower case and for checking whether something is an alpha character. If you want the other functions, such as isDigit(), isPunctuation(), etc. you still have to import std.ascii

Re: Naming conventions for functions in similar modules

2011-06-22 Thread Andrej Mitrovic
On 6/22/11, Kagamin wrote: > Did you try renamed imports? I guess that could work. I'm forgetting how many features we have in D. :p

Re: Naming conventions for functions in similar modules

2011-06-22 Thread Jonathan M Davis
On 2011-06-22 04:47, Lars T. Kyllingstad wrote: > On Tue, 21 Jun 2011 23:30:49 -0700, Walter Bright wrote: > > On 6/21/2011 10:38 PM, Jonathan M Davis wrote: > >> For example, should we have > >> > std.ascii.toLower and std.uni.toLower or std.ascii.toAsciiLower and > std.uni.toUniLower?

Re: Naming conventions for functions in similar modules

2011-06-22 Thread Andrej Mitrovic
On 6/22/11, so wrote: > I am confused, you said typing module names tedious and now you are saying > it is fine typing taskPool.reduce every time. It's less to type, that's what I mean.

Re: Naming conventions for functions in similar modules

2011-06-22 Thread KennyTM~
On Jun 22, 11 19:47, Lars T. Kyllingstad wrote: On Tue, 21 Jun 2011 23:30:49 -0700, Walter Bright wrote: On 6/21/2011 10:38 PM, Jonathan M Davis wrote: For example, should we have std.ascii.toLower and std.uni.toLower or std.ascii.toAsciiLower and std.uni.toUniLower? I think we've failed i

Re: Naming conventions for functions in similar modules

2011-06-22 Thread Andrei Alexandrescu
On 6/22/11 1:30 AM, Walter Bright wrote: On 6/21/2011 10:38 PM, Jonathan M Davis wrote: For example, should we have std.ascii.toLower and std.uni.toLower or std.ascii.toAsciiLower and std.uni.toUniLower? I think we've failed if we have to name things std.ascii.toAsciiLower, i.e. having to re

Re: Naming conventions for functions in similar modules

2011-06-22 Thread so
On Wed, 22 Jun 2011 09:17:56 +0300, Andrej Mitrovic wrote: Another example is std.parallelism.taskPool. It's nice to see code like this: taskPool.reduce!"a + b * b"(0.0, nums); I'll never mistake that for std.algorithm.reduce. And it's not too hard to type. I am confused, you said typi

Re: Naming conventions for functions in similar modules

2011-06-22 Thread Jacob Carlborg
On 2011-06-22 13:47, Lars T. Kyllingstad wrote: On Tue, 21 Jun 2011 23:30:49 -0700, Walter Bright wrote: On 6/21/2011 10:38 PM, Jonathan M Davis wrote: For example, should we have std.ascii.toLower and std.uni.toLower or std.ascii.toAsciiLower and std.uni.toUniLower? I think we've failed i

Re: Naming conventions for functions in similar modules

2011-06-22 Thread Lars T. Kyllingstad
On Tue, 21 Jun 2011 23:30:49 -0700, Walter Bright wrote: > On 6/21/2011 10:38 PM, Jonathan M Davis wrote: >> For example, should we have std.ascii.toLower and std.uni.toLower or std.ascii.toAsciiLower and std.uni.toUniLower? > > > I think we've failed if we have to name things std.asci

Re: Naming conventions for functions in similar modules

2011-06-22 Thread Kagamin
> > > something in their name to distinguish them. For example, should we have > > > std.ascii.toLower and std.uni.toLower or std.ascii.toAsciiLower and > > > std.uni.toUniLower? toAsciiLower seems to be an optimization so it should be valid to import it statically or give it an ugly name because

Re: Naming conventions for functions in similar modules

2011-06-22 Thread Kagamin
Andrej Mitrovic Wrote: > Yeah I'm getting a little tired of naming clashes. > import std.foo; > import std.bar : doo; > > import std.foo; > import std.bar; > alias std.bar.doo doo; > > import std.foo; > static import std.bar; // woops, now we have to prepend std.bar >

Re: Naming conventions for functions in similar modules

2011-06-21 Thread Walter Bright
On 6/21/2011 10:38 PM, Jonathan M Davis wrote: For example, should we have std.ascii.toLower and std.uni.toLower or std.ascii.toAsciiLower and std.uni.toUniLower? I think we've failed if we have to name things std.ascii.toAsciiLower, i.e. having to repeat the module name in the function name

Re: Naming conventions for functions in similar modules

2011-06-21 Thread Andrej Mitrovic
Yeah I'm getting a little tired of naming clashes. I'm not a fan of having to use "std.module" in front of every function call that has name clashes. Let's say I have a lot of code and want to use some symbol, but I get name clashes. One workaround is to use selective imports, but this can't work

Re: Naming conventions for functions in similar modules

2011-06-21 Thread Jonathan M Davis
On 2011-06-21 22:31, Jose Armando Garcia wrote: > On Wed, Jun 22, 2011 at 2:15 AM, Jonathan M Davis wrote: > > Okay. In discussing a pull request which involves reworking std.ctype > > (which is going to be changed to std.ascii) and std.uni, a naming issue > > has arisen which really needs to be

Re: Naming conventions for functions in similar modules

2011-06-21 Thread Jose Armando Garcia
On Wed, Jun 22, 2011 at 2:15 AM, Jonathan M Davis wrote: > Okay. In discussing a pull request which involves reworking std.ctype (which > is going to be changed to std.ascii) and std.uni, a naming issue has arisen > which really needs to be decided on. It's going to affect other modules in the > f

Naming conventions for functions in similar modules

2011-06-21 Thread Jonathan M Davis
Okay. In discussing a pull request which involves reworking std.ctype (which is going to be changed to std.ascii) and std.uni, a naming issue has arisen which really needs to be decided on. It's going to affect other modules in the future (particularly std.algorithm and std.parallel_algorithm),