www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Why std.stdio and not std.io ?

reply Tom <Tom_member pathlink.com> writes:
Maybe it sounds as a stupid question but I still wonder why to mimic C include
name for standard input/output.

Regards,


--
Tom;
Argentina
May 09 2006
next sibling parent reply Stewart Gordon <smjg_1998 yahoo.com> writes:
Please note that discussion of this has already begun on d.D.announce.

If you're going to repost a question that's been posted on another 
'group, you should always refer to pre-existing discussion.

Simply posting the original message verbatim as if it's new is nearly as 
bad as simple multiposting.

Stewart.

-- 
-----BEGIN GEEK CODE BLOCK-----
Version: 3.1
GCS/M d- s:-  C++  a->--- UB  P+ L E  W++  N+++ o K-  w++  O? M V? PS- 
PE- Y? PGP- t- 5? X? R b DI? D G e++++ h-- r-- !y
------END GEEK CODE BLOCK------

My e-mail is valid but not my primary mailbox.  Please keep replies on 
the 'group where everyone may benefit.
May 09 2006
parent Tom <Tom_member pathlink.com> writes:
I posted in announce and reposted there immediately as I post in there by
mistake, then I posted here.

Sorry,

In article <e3qg7b$2val$1 digitaldaemon.com>, Stewart Gordon says...
Please note that discussion of this has already begun on d.D.announce.

If you're going to repost a question that's been posted on another 
'group, you should always refer to pre-existing discussion.

Simply posting the original message verbatim as if it's new is nearly as 
bad as simple multiposting.

Stewart.

-- 
-----BEGIN GEEK CODE BLOCK-----
Version: 3.1
GCS/M d- s:-  C++  a->--- UB  P+ L E  W++  N+++ o K-  w++  O? M V? PS- 
PE- Y? PGP- t- 5? X? R b DI? D G e++++ h-- r-- !y
------END GEEK CODE BLOCK------

My e-mail is valid but not my primary mailbox.  Please keep replies on 
the 'group where everyone may benefit.

-- Tom;
May 09 2006
prev sibling next sibling parent reply Lucas Goss <lgoss007 gmail.com> writes:
Tom wrote:
 Maybe it sounds as a stupid question but I still wonder why to mimic C include
 name for standard input/output.

I wonder the same. I also wonder why not... std.unicode - instead of std.uni std.c.ctype - instead of std.ctype std.conversion - instead of std.conv std.c.stream? - instead of std.cstream std.memorymappedfile - instead of std.mmfile ...more? And on a related note, why mimic C functions: std.file: isFile - instead of isfile isDirectory - instead of isdir ... std.string: isWhite - instead of iswhite stringToInt - instead of atoi compare - instead of cmp ... Sure it might be nice for C programmers, but a pain for others not familiar with a certain function in C. And using the C counterparts could be as easy as "using std.c.string", etc. I just find readability and consistency to be a huge plus in a library, especially one that is standard. If such changes would be accepted, or even considered, I'd be happy to do the work on this part of the library. I've even thought of re-doing it just for my personal use. Lucas
May 09 2006
parent reply Stewart Gordon <smjg_1998 yahoo.com> writes:
Lucas Goss wrote:
 Tom wrote:
 Maybe it sounds as a stupid question but I still wonder why to mimic C 
 include
 name for standard input/output.

I wonder the same. I also wonder why not... std.unicode - instead of std.uni std.c.ctype - instead of std.ctype std.conversion - instead of std.conv std.c.stream? - instead of std.cstream std.memorymappedfile - instead of std.mmfile ...more?

Because std.c.* is reserved for translations of C API headers. Stewart. -- -----BEGIN GEEK CODE BLOCK----- Version: 3.1 GCS/M d- s:- C++ a->--- UB P+ L E W++ N+++ o K- w++ O? M V? PS- PE- Y? PGP- t- 5? X? R b DI? D G e++++ h-- r-- !y ------END GEEK CODE BLOCK------ My e-mail is valid but not my primary mailbox. Please keep replies on the 'group where everyone may benefit.
May 09 2006
parent reply Lucas Goss <lgoss007 gmail.com> writes:
Stewart Gordon wrote:
 Lucas Goss wrote:
 I wonder the same. I also wonder why not...

 std.unicode - instead of std.uni
 std.c.ctype - instead of std.ctype
 std.conversion - instead of std.conv
 std.c.stream? - instead of std.cstream
 std.memorymappedfile - instead of std.mmfile
 ...more?

Because std.c.* is reserved for translations of C API headers.

Ok that explains std.cstream, but isn't std.ctype a translation of ctype.h? Well I guess it doesn't use any C library, but it's essentially a copy ctype.h. The C libraries just seem to clutter up the niceness of D, and make it not so appealing to me. I can see the usefulness of having them to prototype functions until they can be redone later, but using the same naming just seems odd and makes the language feel outdated and hard to read. It also scares me a little because I'm sure someone will bring up the case that the naming can't be changed in the future because of backward compatibility. Makes me sad... Lucas
May 09 2006
next sibling parent reply Chad J <gamerChad _spamIsBad_gmail.com> writes:
Lucas Goss wrote:
 
 Ok that explains std.cstream, but isn't std.ctype a translation of 
 ctype.h? Well I guess it doesn't use any C library, but it's essentially 
 a copy ctype.h. The C libraries just seem to clutter up the niceness of 
 D, and make it not so appealing to me. I can see the usefulness of 
 having them to prototype functions until they can be redone later, but 
 using the same naming just seems odd and makes the language feel 
 outdated and hard to read. It also scares me a little because I'm sure 
 someone will bring up the case that the naming can't be changed in the 
 future because of backward compatibility. Makes me sad...
 
 Lucas

I agree here. Leave the old C naming convention to std.c.* . For all of the D functions, use more descriptive/intuitive and consistant names. I hope the other major libraries (Ares, Mango) will take this to heart as well. I noticed "atoi" in Mango. atoi makes sense if you come from a C background, otherwise you'd have no idea what it does until you read the description.
May 09 2006
parent Lucas Goss <lgoss007 gmail.com> writes:
Chad J wrote:
  I hope the other major libraries (Ares, Mango) will take this to heart 
 as well.  I noticed "atoi" in Mango.  atoi makes sense if you come from 
 a C background, otherwise you'd have no idea what it does until you read 
 the description.

Yeah I asked in the Ares forum about this, and the response was that Ares will stay as close as possible to DigitalMars for dmdrt and dmdgc: http://www.dsource.org/forums/viewtopic.php?t=1468 So I'd like to try to get dmdrt and dmdgc changed before it's too late. Lucas
May 09 2006
prev sibling parent reply Walter Bright <newshound digitalmars.com> writes:
Lucas Goss wrote:
 Ok that explains std.cstream, but isn't std.ctype a translation of 
 ctype.h? Well I guess it doesn't use any C library, but it's essentially 
 a copy ctype.h.

No. The std.c.ctype functions are exactly the same as the corresponding C <ctype.h> functions, i.e. they work with code pages, locales, etc. D is a unicode language, and the std.ctype functions specifically only work with ASCII (use the std.uni functions for unicode). Having the separate std.ctype functions is because they are much simpler and faster than the std.uni ones. std.uni isn't called std.unicode because unicode is trademarked.
May 13 2006
next sibling parent =?ISO-8859-1?Q?Anders_F_Bj=F6rklund?= <afb algonet.se> writes:
Walter Bright wrote:

 std.uni isn't called std.unicode because unicode is trademarked.

But isn't windows and linux also trademarked ? Oh well... --anders
May 13 2006
prev sibling next sibling parent reply Sean Kelly <sean f4.ca> writes:
Walter Bright wrote:
 
 std.uni isn't called std.unicode because unicode is trademarked.

It is? *sigh* People really need to stop doing that. Sean
May 13 2006
parent reply Daniel Keep <daniel.keep.lists gmail.com> writes:
Check this out: http://www.unicode.org/policies/logo_policy.html

Sounds pretty heavy-handed.  If you wanted to use 'unicode' in the name
of the module, it looks like it would have to be named:

	std/supportfortheunicode™standard.d

And yes, that ™ MUST be there (at least, they say it must).  This'd be
funny in the D docs:

"To use the D functions in support of the Unicode™ Standard, you should
import the support for the Unicode™ Standard standard module like so:

	"import std.longAnnoyingJavaStyleNames.supportForTheUnicode" (Alt+0153)
"Standard;"

If you're not running Windows, then... umm... I dunno... use copy and
paste?"

Whilst according to their own policy, the abbreviation "Uni-" is generic
enough that it isn't protected by trademarks.  In that light, viva la
"std.uni" :)

	-- Daniel

Sean Kelly wrote:
 Walter Bright wrote:
 std.uni isn't called std.unicode because unicode is trademarked.

It is? *sigh* People really need to stop doing that. Sean

-- v1sw5+8Yhw5ln4+5pr6OFma8u6+7Lw4Tm6+7l6+7D a2Xs3MSr2e4/6+7t4TNSMb6HTOp5en5g6RAHCP http://hackerkey.com/
May 13 2006
parent reply John C <johnch_atms hotmail.com> writes:
Daniel Keep wrote:
 Check this out: http://www.unicode.org/policies/logo_policy.html
 
 Sounds pretty heavy-handed.  If you wanted to use 'unicode' in the name
 of the module, it looks like it would have to be named:
 
 	std/supportfortheunicode™standard.d
 
 And yes, that ™ MUST be there (at least, they say it must).  This'd be
 funny in the D docs:
 
 "To use the D functions in support of the Unicode™ Standard, you should
 import the support for the Unicode™ Standard standard module like so:
 
 	"import std.longAnnoyingJavaStyleNames.supportForTheUnicode" (Alt+0153)
 "Standard;"
 
 If you're not running Windows, then... umm... I dunno... use copy and
 paste?"
 
 Whilst according to their own policy, the abbreviation "Uni-" is generic
 enough that it isn't protected by trademarks.  In that light, viva la
 "std.uni" :)
 
 	-- Daniel
 
 Sean Kelly wrote:
 
Walter Bright wrote:

std.uni isn't called std.unicode because unicode is trademarked.

It is? *sigh* People really need to stop doing that. Sean


Surely you're taking this too literally. Both Windows and Linux are trademarked, and yet the std library uses those as module/file names.
May 14 2006
parent Daniel Keep <daniel.keep.lists gmail.com> writes:
John C wrote:
 Daniel Keep wrote:
 Check this out: http://www.unicode.org/policies/logo_policy.html

 Sounds pretty heavy-handed.  If you wanted to use 'unicode' in the name
 of the module, it looks like it would have to be named:

     std/supportfortheunicode™standard.d

 And yes, that ™ MUST be there (at least, they say it must).  This'd be
 funny in the D docs:

 "To use the D functions in support of the Unicode™ Standard, you should
 import the support for the Unicode™ Standard standard module like so:

     "import std.longAnnoyingJavaStyleNames.supportForTheUnicode"
 (Alt+0153)
 "Standard;"

 If you're not running Windows, then... umm... I dunno... use copy and
 paste?"

 Whilst according to their own policy, the abbreviation "Uni-" is generic
 enough that it isn't protected by trademarks.  In that light, viva la
 "std.uni" :)

     -- Daniel

 Sean Kelly wrote:

 Walter Bright wrote:

 std.uni isn't called std.unicode because unicode is trademarked.

It is? *sigh* People really need to stop doing that. Sean


Surely you're taking this too literally. Both Windows and Linux are trademarked, and yet the std library uses those as module/file names.

Very probably. I *was* half-joking; but still, given what that page says, I'd go with 'uni' myself just to make absolutely sure. Their trademark policy only seems to cover using their name in product descriptions, etc. In any case, I think Walter made the right choice. Incidentally, I never knew that Unicode had a logo. Guess no one uses it because of the trademark stuff :P Aah, intellectual property law is such fun... -- Daniel -- v1sw5+8Yhw5ln4+5pr6OFma8u6+7Lw4Tm6+7l6+7D a2Xs3MSr2e4/6+7t4TNSMb6HTOp5en5g6RAHCP http://hackerkey.com/
May 14 2006
prev sibling parent reply Stewart Gordon <smjg_1998 yahoo.com> writes:
Walter Bright wrote:
<snip>
 std.uni isn't called std.unicode because unicode is trademarked.

I don't really see how you'd be infringing the trademark by simply using it as part of the name of a library module for Unicode support. Is it really any different from products having names in the form "X for Windows"? Stewart. -- -----BEGIN GEEK CODE BLOCK----- Version: 3.1 GCS/M d- s:- C++ a->--- UB P+ L E W++ N+++ o K- w++ O? M V? PS- PE- Y? PGP- t- 5? X? R b DI? D G e++++ h-- r-- !y ------END GEEK CODE BLOCK------ My e-mail is valid but not my primary mailbox. Please keep replies on the 'group where everyone may benefit.
May 15 2006
parent reply Walter Bright <newshound digitalmars.com> writes:
Stewart Gordon wrote:
 Walter Bright wrote:
 <snip>
 std.uni isn't called std.unicode because unicode is trademarked.

I don't really see how you'd be infringing the trademark by simply using it as part of the name of a library module for Unicode support. Is it really any different from products having names in the form "X for Windows"? Stewart.

See: http://www.unicode.org/policies/logo_policy.html
May 15 2006
next sibling parent Sean Kelly <sean f4.ca> writes:
Walter Bright wrote:
 Stewart Gordon wrote:
 Walter Bright wrote:
 <snip>
 std.uni isn't called std.unicode because unicode is trademarked.

I don't really see how you'd be infringing the trademark by simply using it as part of the name of a library module for Unicode support. Is it really any different from products having names in the form "X for Windows"?

See: http://www.unicode.org/policies/logo_policy.html

Technically, I think modules names may be exempt as the language all concerns logos, documentation, and packaging. But it's simply not worth the trouble, particularly for a standard library that others are expected to adopt. I currently have a "std.unicode" module in Ares and plan to change it now that I know this. Frankly, I find it exceedingly irritating that an open standard such as Unicode (tm) should have such restrictions, and I wish I could simply thumb my nose at them and adopt a different standard, but such is life. Sean
May 15 2006
prev sibling parent Roberto Mariottini <Roberto_member pathlink.com> writes:
In article <e4anei$2reb$2 digitaldaemon.com>, Walter Bright says...
 <snip>
 std.uni isn't called std.unicode because unicode is trademarked.

But I think also UNI is: http://www.uni.com/uni/controller/en/ :-) Ciao --- http://www.mariottini.net/roberto/
May 16 2006
prev sibling next sibling parent Bruno Medeiros <brunodomedeirosATgmail SPAM.com> writes:
Tom wrote:
 Maybe it sounds as a stupid question but I still wonder why to mimic C include
 name for standard input/output.
 
 Regards,
 
 
 --
 Tom;
 Argentina

Here's a nice usage scenario for code refactoring capabilities. :) -- Bruno Medeiros - CS/E student http://www.prowiki.org/wiki4d/wiki.cgi?BrunoMedeiros#D
May 09 2006
prev sibling next sibling parent reply Derek Parnell <derek psych.ward> writes:
On Tue, 9 May 2006 15:06:18 +0000 (UTC), Tom wrote:

 Maybe it sounds as a stupid question but I still wonder why to mimic C include
 name for standard input/output.
 
 Regards,

"std.stdio" is the Standard I/O module in the "std" package. It allows for such things as "std.extio" which might be an Extended I/O module but still in the "std" package. In other words "stdio" describes an I/O module as 'standard' and "std." describes a package as 'standard'. -- Derek (skype: derek.j.parnell) Melbourne, Australia "Down with mediocracy!" 10/05/2006 1:54:35 PM
May 09 2006
parent reply Nils Hensel <nils.hensel web.de> writes:
Derek Parnell schrieb:
 "std.stdio" is the Standard I/O module in the "std" package. It allows for
 such things as "std.extio" which might be an Extended I/O module but still
 in the "std" package. In other words "stdio" describes an I/O module as
 'standard' and "std." describes a package as 'standard'.

Following that logic std.math should be called std.stdmath because it might get extended by std.extmath? Why don't just leave out the prefix for standard modules? Nils
May 09 2006
parent Derek Parnell <derek psych.ward> writes:
On Wed, 10 May 2006 08:42:25 +0200, Nils Hensel wrote:

 Derek Parnell schrieb:
 "std.stdio" is the Standard I/O module in the "std" package. It allows for
 such things as "std.extio" which might be an Extended I/O module but still
 in the "std" package. In other words "stdio" describes an I/O module as
 'standard' and "std." describes a package as 'standard'.

Following that logic std.math should be called std.stdmath because it might get extended by std.extmath? Why don't just leave out the prefix for standard modules?

Totally agree - but who has ever accused Walter of being 100% logical ;-) -- Derek (skype: derek.j.parnell) Melbourne, Australia "Down with mediocracy!" 10/05/2006 5:22:33 PM
May 10 2006
prev sibling parent reply Walter Bright <newshound digitalmars.com> writes:
Tom wrote:
 Maybe it sounds as a stupid question but I still wonder why to mimic C include
 name for standard input/output.

'std' is the package for standard D library functions. 'stdio' is the module for accessing the C standard I/O streams stdin, stdout, and stderr. std.c.stdio is for access to the C <stdio.h> functions and declarations. So the std in std and stdio are two different meanings of 'standard'.
May 13 2006
parent reply =?ISO-8859-1?Q?Anders_F_Bj=F6rklund?= <afb algonet.se> writes:
Walter Bright wrote:

 'stdio' is the module for accessing the C standard I/O streams stdin, 
 stdout, and stderr.

As in "eventually", yes ? There's no stdin in std.stdio at the moment. (arguably all streams in std.stdio just come from std.c.stdio anyway) Q: Will readf make it into D 1.0 ? --anders
May 13 2006
parent reply Walter Bright <newshound digitalmars.com> writes:
Anders F Björklund wrote:
 Walter Bright wrote:
 
 'stdio' is the module for accessing the C standard I/O streams stdin, 
 stdout, and stderr.

As in "eventually", yes ? There's no stdin in std.stdio at the moment. (arguably all streams in std.stdio just come from std.c.stdio anyway)

writef, for example, writes to stdout.
 Q: Will readf make it into D 1.0 ?

sure.
May 13 2006
parent reply =?ISO-8859-1?Q?Anders_F_Bj=F6rklund?= <afb algonet.se> writes:
Walter Bright wrote:

 As in "eventually", yes ? There's no stdin in std.stdio at the moment.
 (arguably all streams in std.stdio just come from std.c.stdio anyway)

writef, for example, writes to stdout.

That it does, I just meant that it writes to the "regular" std.c.stdio.stdout and not any special std.stdio.stdout ? I guess we have std.cstream.dout, for the "special" stuff ? along with the other two Streams, that is: din, dout, derr --anders
May 13 2006
parent Walter Bright <newshound digitalmars.com> writes:
Anders F Björklund wrote:
 Walter Bright wrote:
 
 As in "eventually", yes ? There's no stdin in std.stdio at the moment.
 (arguably all streams in std.stdio just come from std.c.stdio anyway)

writef, for example, writes to stdout.

That it does, I just meant that it writes to the "regular" std.c.stdio.stdout and not any special std.stdio.stdout ?

That's right. You can interleave calls to printf and writef, and it'll come out right.
May 13 2006