Re: formattedWrite writes nothing

2014-05-02 Thread Jared Miller via Digitalmars-d-learn


I logged this bug a while ago:

https://issues.dlang.org/show_bug.cgi?id=10291


On Friday, 2 May 2014 at 10:06:43 UTC, ref2401 wrote:


Is it a bug or is there a reason for such behaviour?




Re: formattedWrite writes nothing

2014-05-02 Thread anonymous via Digitalmars-d-learn
On Friday, 2 May 2014 at 10:23:03 UTC, Andrej Mitrovic via 
Digitalmars-d-learn wrote:
Ouch, ouch, ouch! What's happening is that the 'clear' Appender 
method

is only compiled-in if the data is mutable, otherwise you end up
calling the object.clear UFCS function. So don't use clear here.

I don't know if this is a case of poor method naming or another
downside of UFCS. Luckily 'clear' is being renamed to 'destroy' 
in the
object module, so this specific case will not become a problem 
in the

future.


I'd say clear should be @disabled in Appender for non-mutable 
data.


Re: formattedWrite writes nothing

2014-05-02 Thread Andrej Mitrovic via Digitalmars-d-learn
On 5/2/14, ref2401 via Digitalmars-d-learn
 wrote:
> class MyClass {
>   Appender!string _stringBuilder;
>
>   this() {
>   _stringBuilder = Appender!string(null);
>   _stringBuilder.clear();

Ouch, ouch, ouch! What's happening is that the 'clear' Appender method
is only compiled-in if the data is mutable, otherwise you end up
calling the object.clear UFCS function. So don't use clear here.

I don't know if this is a case of poor method naming or another
downside of UFCS. Luckily 'clear' is being renamed to 'destroy' in the
object module, so this specific case will not become a problem in the
future.


Re: formattedWrite

2011-08-08 Thread simendsjo

On 08.08.2011 14:07, simendsjo wrote:

On 08.08.2011 13:41, simendsjo wrote:

On 08.08.2011 13:37, Vladimir Panteleev wrote:

On Mon, 08 Aug 2011 14:37:26 +0300, simendsjo 
wrote:


I cannot find any string format() method in phobos.


What's wrong with format() from std.string?



Thanks, that was the function I was looking for. I just expected it to
be in std.format (and I also looked in std.stdio).


Seems std.string.format is missing positional arguments..


http://d.puremagic.com/issues/show_bug.cgi?id=6455


Re: formattedWrite

2011-08-08 Thread simendsjo

On 08.08.2011 13:41, simendsjo wrote:

On 08.08.2011 13:37, Vladimir Panteleev wrote:

On Mon, 08 Aug 2011 14:37:26 +0300, simendsjo 
wrote:


I cannot find any string format() method in phobos.


What's wrong with format() from std.string?



Thanks, that was the function I was looking for. I just expected it to
be in std.format (and I also looked in std.stdio).


Seems std.string.format is missing positional arguments..


Re: formattedWrite

2011-08-08 Thread simendsjo

On 08.08.2011 13:37, Vladimir Panteleev wrote:

On Mon, 08 Aug 2011 14:37:26 +0300, simendsjo  wrote:


I cannot find any string format() method in phobos.


What's wrong with format() from std.string?



Thanks, that was the function I was looking for. I just expected it to 
be in std.format (and I also looked in std.stdio).


Re: formattedWrite

2011-08-08 Thread Vladimir Panteleev

On Mon, 08 Aug 2011 14:37:26 +0300, simendsjo  wrote:


I cannot find any string format() method in phobos.


What's wrong with format() from std.string?

--
Best regards,
 Vladimirmailto:vladi...@thecybershadow.net