On 11/10/2014 12:04 PM, Suliman wrote:
Thanks!
Ali Çehreli, could you add this mention and possible the example to your
book?
Of course. Perhaps I should rephrase some of the descriptions here?
http://ddili.org/ders/d.en/ufcs.html
Please email me at acehr...@yahoo.com if you have specific
Thanks!
Ali Çehreli, could you add this mention and possible the example
to your book?
On 11/10/2014 11:07 AM, Suliman wrote:
I can't understand how to use UFCS with instance of class:
void main()
{
string name = "Suliman";
userName username = new userName(name);
/// How to use UFCS here?
userName.name.sayHello();
///
}
class userName
{
string name;
this(string name)
On Mon, 10 Nov 2014 19:07:38 +, Suliman wrote:
> I can't understand how to use UFCS with instance of class:
>
> void main()
> {
>
> string name = "Suliman";
> userName username = new userName(name);
>
> /// How to use UFCS here?
> userName.name.sayHello();
> ///
> }
>
> class userName {
>
On Mon, 10 Nov 2014 19:07:38 +
Suliman via Digitalmars-d-learn
wrote:
> /// How to use UFCS here?
> userName.name.sayHello();
> ///
you can't.
a little explanation: UFCS substitutes only the first argument. and for
class methods first argument is hidden 'this'. so you can't do it in
this way
I can't understand how to use UFCS with instance of class:
void main()
{
string name = "Suliman";
userName username = new userName(name);
/// How to use UFCS here?
userName.name.sayHello();
///
}
class userName
{
string name;
this(string name)
{
this.name = name;
}
On 9/30/14 2:07 PM, Ali Çehreli wrote:
Apparently, a class definition even inside a unittest blocks are
considered to be nested classes.
Normally, objects of nested classes are created by the 'this.new'
syntax, 'this' meaning the object that wraps the nested class.
I think unit test blocks a
On 09/30/2014 11:07 AM, Ali Çehreli wrote:
> To make a nested class unnested, declare it as static, which seems to
> work in your case as well:
>
> class C { int x, y; }
> auto x = New!C();
Copy+paste cannot read my mind. :( Of course there should be 'static'
keyword there. :p
s
On 09/30/2014 10:35 AM, "Nordlöw" wrote:
> On Sunday, 28 September 2014 at 20:28:11 UTC, Jay wrote:
>> fwiw here's what i wrote:
>>
>> template New(T) if (is(T == class)) {
>> T New(Args...) (Args args) {
>> return new T(args);
>> }
>> }
>
> My try
>
> template New(T) if (is(T ==
On Sunday, 28 September 2014 at 20:28:11 UTC, Jay wrote:
fwiw here's what i wrote:
template New(T) if (is(T == class)) {
T New(Args...) (Args args) {
return new T(args);
}
}
My try
template New(T) if (is(T == class))
{
T New(Args...) (Args args) {
return new T(args
On Sunday, 28 September 2014 at 22:17:03 UTC, Meta wrote:
I'm not sure. Maybe it's on the same level as the Lambda
Abstraction (14.5), but you'll probably have to do some testing
to figure it out exactly.
precedence levels seem to be defined in `src/parse.h` (the `PREC`
enum) and assigned to
On Sunday, 28 September 2014 at 20:50:07 UTC, Jay wrote:
On Sunday, 28 September 2014 at 20:30:42 UTC, Meta wrote:
class Button
{
typeof(this) text(string t)
{
return this;
}
typeof(this) textColour(int c)
{
return
On Sunday, 28 September 2014 at 20:30:42 UTC, Meta wrote:
class Button
{
typeof(this) text(string t)
{
return this;
}
typeof(this) textColour(int c)
{
return this;
}
}
void main()
{
auto b = new Butt
On Sunday, 28 September 2014 at 19:11:23 UTC, Jay wrote:
i want to chain 'new' with method calls on the created object.
i found this on the internet:
window.mainWidget = (new Button()).text("Hello
world"d).textColor(0xFF);
it would look much nicer with UFCS:
window.mainWidget = Button.n
On Sunday, 28 September 2014 at 19:19:56 UTC, Foo wrote:
mixin template New(T) if (is(T == class)) {
static T New(Args...)(Args args) {
return new T(args);
}
}
fwiw here's what i wrote:
template New(T) if (is(T == class)) {
T New(Args...) (Args args) {
r
On Sunday, 28 September 2014 at 19:41:29 UTC, Idan Arye wrote:
Because `new` is not a function - it's an operator.
do you think the function call syntax has any chance to be
implemented? is it just me who needs it?
On Sunday, 28 September 2014 at 19:32:11 UTC, Jay wrote:
thanks! but i'm still interested *why* you can't have this with
'new'. if there's no good reason i will file a bug report.
Because `new` is not a function - it's an operator.
thanks! but i'm still interested *why* you can't have this with
'new'. if there's no good reason i will file a bug report.
On Sunday, 28 September 2014 at 19:19:56 UTC, Foo wrote:
mixin template New(T) if (is(T == class)) {
static T New(Args...)(Args args) {
return new T(arg
On Sunday, 28 September 2014 at 19:11:23 UTC, Jay wrote:
i want to chain 'new' with method calls on the created object.
i found this on the internet:
window.mainWidget = (new Button()).text("Hello
world"d).textColor(0xFF);
it would look much nicer with UFCS:
window.mainWidget = Button.n
i want to chain 'new' with method calls on the created object. i
found this on the internet:
window.mainWidget = (new Button()).text("Hello
world"d).textColor(0xFF);
it would look much nicer with UFCS:
window.mainWidget = Button.new().text("Hello
world"d).textColor(0xFF);
well, it
20 matches
Mail list logo