Thread overview | |||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
February 04, 2016 print function | ||||
---|---|---|---|---|
| ||||
It would be nice to have a simple writeln that adds spaces automatically like Python's 'print' in std.stdio, perhaps called print. |
February 04, 2016 Re: print function | ||||
---|---|---|---|---|
| ||||
Posted in reply to ixid | On Thursday, 4 February 2016 at 00:23:07 UTC, ixid wrote:
> It would be nice to have a simple writeln that adds spaces automatically like Python's 'print' in std.stdio, perhaps called print.
Sounds way too redundant to me.
|
February 04, 2016 Re: print function | ||||
---|---|---|---|---|
| ||||
Posted in reply to cym13 | On Thursday, 4 February 2016 at 00:30:03 UTC, cym13 wrote:
> On Thursday, 4 February 2016 at 00:23:07 UTC, ixid wrote:
>> It would be nice to have a simple writeln that adds spaces automatically like Python's 'print' in std.stdio, perhaps called print.
>
> Sounds way too redundant to me.
Normally you'd be right but printing out data is such a common thing, especially for beginners. It's the kind of thing that can make their early experience of a language a lot more positive.
writeln(a, " ", b, " ", c, " ", d);
Is very clunky. Programming languages are like cereal, you need sugar to get the kids hooked.
|
February 03, 2016 Re: print function | ||||
---|---|---|---|---|
| ||||
Posted in reply to ixid | On Thursday, February 04, 2016 00:23:07 ixid via Digitalmars-d-learn wrote:
> It would be nice to have a simple writeln that adds spaces automatically like Python's 'print' in std.stdio, perhaps called print.
If that's what you're looking for, I expect that most of us would think that it's just better to use writefln with a format string. But if you really want it, you can always create such a wrapper yourself.
- Jonathan M Davis
|
February 04, 2016 Re: print function | ||||
---|---|---|---|---|
| ||||
Posted in reply to ixid | On Thursday, February 04, 2016 00:40:55 ixid via Digitalmars-d-learn wrote:
> On Thursday, 4 February 2016 at 00:30:03 UTC, cym13 wrote:
> > On Thursday, 4 February 2016 at 00:23:07 UTC, ixid wrote:
> >> It would be nice to have a simple writeln that adds spaces automatically like Python's 'print' in std.stdio, perhaps called print.
> >
> > Sounds way too redundant to me.
>
> Normally you'd be right but printing out data is such a common thing, especially for beginners. It's the kind of thing that can make their early experience of a language a lot more positive.
>
> writeln(a, " ", b, " ", c, " ", d);
>
> Is very clunky. Programming languages are like cereal, you need sugar to get the kids hooked.
I would normally expect someone to do that with writefln, which would be cleaner. e.g.
writefln("%s %s %s %s", a, b, c, d);
Personally, I've never felt the need for a function like you're describing.
- Jonathan M Davis
|
February 04, 2016 Re: print function | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jonathan M Davis | On Thursday, 4 February 2016 at 10:05:15 UTC, Jonathan M Davis wrote:
> I would normally expect someone to do that with writefln, which would be cleaner. e.g.
>
> writefln("%s %s %s %s", a, b, c, d);
>
> Personally, I've never felt the need for a function like you're describing.
>
> - Jonathan M Davis
Do you think your knowledge and experience is a good model for how a new user who hasn't done much if any programming before would approach this?
|
February 04, 2016 Re: print function | ||||
---|---|---|---|---|
| ||||
Posted in reply to ixid | On Thursday, 4 February 2016 at 10:18:35 UTC, ixid wrote:
> On Thursday, 4 February 2016 at 10:05:15 UTC, Jonathan M Davis wrote:
>> I would normally expect someone to do that with writefln, which would be cleaner. e.g.
>>
>> writefln("%s %s %s %s", a, b, c, d);
>>
>> Personally, I've never felt the need for a function like you're describing.
>>
>> - Jonathan M Davis
>
> Do you think your knowledge and experience is a good model for how a new user who hasn't done much if any programming before would approach this?
IMO, while giving beginner's a helping hand is a great thing, I don't think it's a good basis to use as a design for a standard library.
|
February 04, 2016 Re: print function | ||||
---|---|---|---|---|
| ||||
Posted in reply to Mike Parker | On Thursday, 4 February 2016 at 10:59:50 UTC, Mike Parker wrote:
> IMO, while giving beginner's a helping hand is a great thing, I don't think it's a good basis to use as a design for a standard library.
Yes, better to have a "beginners toolkit" starting-point-codebase and build a tutorial around it.
|
February 04, 2016 Re: print function | ||||
---|---|---|---|---|
| ||||
Posted in reply to ixid | On Thursday, 4 February 2016 at 10:18:35 UTC, ixid wrote:
> Do you think your knowledge and experience is a good model for how a new user who hasn't done much if any programming before would approach this?
A design choice had to be made and made it was. Adding another function now (or worse, changing the existing ones) would only bring more confusion for beginners and unconsistency to the language. I firmly believe that no matter what your experience you have having one and preferably only one way to do things is more important to ease the learning process than having spaces or not.
|
February 04, 2016 Re: print function | ||||
---|---|---|---|---|
| ||||
Posted in reply to cym13 | On Thursday, 4 February 2016 at 11:04:23 UTC, cym13 wrote:
> On Thursday, 4 February 2016 at 10:18:35 UTC, ixid wrote:
>> Do you think your knowledge and experience is a good model for how a new user who hasn't done much if any programming before would approach this?
>
> A design choice had to be made and made it was. Adding another function now (or worse, changing the existing ones) would only bring more confusion for beginners and unconsistency to the language. I firmly believe that no matter what your experience you have having one and preferably only one way to do things is more important to ease the learning process than having spaces or not.
That's a nonsensical argument given the number of printing and writing functions that exist.
|
Copyright © 1999-2021 by the D Language Foundation