On Tuesday, 24 July 2018 at 21:05:05 UTC, Jean-Louis Leroy wrote:
What is `PT` here:
https://github.com/dlang/phobos/blob/master/std/traits.d#L1224
Where does it come from?
https://dlang.org/spec/expression.html#is_expression
look for
6. is ( Type Identifier == TypeSpecialization )
On Sunday, 24 June 2018 at 19:10:36 UTC, Mr.Bingo wrote:
On Sunday, 24 June 2018 at 18:21:09 UTC, rjframe wrote:
On Sun, 24 Jun 2018 14:43:09 +, Mr.Bingo wrote:
let is(CTFE == x) mean that x is a compile time constant.
CTFE(x)
converts a x to this compile time constant. Passing any
On Saturday, 16 June 2018 at 23:33:18 UTC, Aedt wrote:
Hello, I was wondering if there's any quick refresher resource
to brush up on my D after a long time? Is there a short and
quick language reference book like "A Tour of C++"?
if you havent seen it yet, there is the dlang tour
On Tuesday, 29 May 2018 at 19:06:24 UTC, DigitalDesigns wrote:
On Monday, 28 May 2018 at 22:15:40 UTC, arturg wrote:
this might help you,
https://dpaste.dzfl.pl/2cf844a11e3f
you can use them to generate the functions as strings.
Thanks,
So, the problem I'm having is that I cannot use the
this might help you,
https://dpaste.dzfl.pl/2cf844a11e3f
you can use them to generate the functions as strings.
On Thursday, 17 May 2018 at 07:30:58 UTC, KingJoffrey wrote:
On Thursday, 17 May 2018 at 06:03:19 UTC, arturg wrote:
you could declare the public api of your class inside an
actual interface then use it instead of the class, that wont
give you access to the private members of the class.
On Thursday, 17 May 2018 at 05:06:54 UTC, KingJoffrey wrote:
If people want to propose putting each class in it's own
module, that does not address my requirements, and therefore is
not helpful to this discussion.
you could declare the public api of your class inside an actual
interface
On Tuesday, 15 May 2018 at 01:40:50 UTC, timepp wrote:
Now C++ allow this in a very clean way:
std::tuple foo() { return {128, true,
1.5f}; }
auto [value1, value2, value3] = foo();
Would D plan to support that in syntax level?
it depends if some dip like
On Wednesday, 9 May 2018 at 10:16:22 UTC, Melvin wrote:
I'm trying to find a friendly syntax for defining things in a
framework. For context, I've been looking into finding a
solution for this problem
(https://github.com/GodotNativeTools/godot-d/issues/1) on the
Godot-D project. I've done
On Thursday, 26 April 2018 at 22:29:46 UTC, Nick Sabalausky
(Abscissa) wrote:
On 04/26/2018 01:13 PM, arturg wrote:
why do people use this syntax?
if val == someVal
or
while val != someVal
it makes editing the code harder then if you use if(val ==
someVal).
The theory goes:
A. "less
On Thursday, 26 April 2018 at 15:07:37 UTC, H. S. Teoh wrote:
On Thu, Apr 26, 2018 at 08:50:27AM +, Joakim via
Digitalmars-d wrote:
https://github.com/felixangell/krug
https://www.reddit.com/r/programming/comments/8dze54/krug_a_systems_programming_language_that_compiles/
It's still too
On Wednesday, 18 April 2018 at 01:58:40 UTC, arturg wrote:
is it this what you want?
class A
{
int a;
void delegate() onDraw;
this(void delegate() dg)
{
onDraw = dg;
}
void drawText(string s)
{
s.writeln;
}
On Wednesday, 18 April 2018 at 01:12:33 UTC, Chris Katko wrote:
That was all pseudo-code typed by hand.
I got my code to work today. I don't know if it's the prettiest
it can be, but it works:
// TESTING ACCESS TO the OWNING function
//---
class
On Thursday, 12 April 2018 at 08:28:17 UTC, Mike Parker wrote:
Around the same time, a Pull Request was created to implement
support for UDAs on function parameters [4]. In the comment
thread for this PR, Andrei said that he and Walter "agree this
can be integrated without a DIP." When he
On Tuesday, 27 March 2018 at 23:34:20 UTC, arturg wrote:
On Tuesday, 27 March 2018 at 23:23:38 UTC, ag0aep6g wrote:
DMD might accept that, but I don't think it works in a
meaningful way. How do you call the @system one?
Looks like the @safe one will always be called, even from
@system
On Tuesday, 27 March 2018 at 23:23:38 UTC, ag0aep6g wrote:
DMD might accept that, but I don't think it works in a
meaningful way. How do you call the @system one?
Looks like the @safe one will always be called, even from
@system code:
import std.stdio;
void talk() @system {
On Tuesday, 27 March 2018 at 21:25:33 UTC, ag0aep6g wrote:
On 03/27/2018 11:10 PM, 12345swordy wrote:
Shouldn't it give a warning then?
I wouldn't mind a warning, or even an error. Putting both @safe
and @system directly on a function is an error, too.
shouldn't it create a overload?
for
On Monday, 26 March 2018 at 06:40:34 UTC, Vladimirs Nordholm
wrote:
How would I resolve this issue?
use the type not the variables:
isNumeric!X && isNumeric!Y
On Saturday, 17 March 2018 at 14:16:19 UTC, bauss wrote:
I don't like the name @deny, personally I would rather see the
private attribute changed to something like:
private(true) // The member is oly visible to its parent.
private(false) // Same as just "private", visible to whole
module.
On Monday, 12 March 2018 at 22:34:10 UTC, Xavier Bigand wrote:
Ok, it works with the alias, I didn't see the last () in the
implementFunctionsOf prototype.
Thank you a lot.
no problem. :)
On Monday, 12 March 2018 at 22:28:30 UTC, Xavier Bigand wrote:
I forgot to precise, that I don't have a main, because I am
trying to create an opengl32.dll. This is why I already have a
mixin to inject to function definitions in the root scope.
you have to pass the string as a template arg
On Monday, 12 March 2018 at 21:00:07 UTC, Xavier Bigand wrote:
Hi,
I have a CTFE function that I want to make more generic by
given it a module as parameter.
My actual code looks like :
mixin(implementFunctionsOf());
string implementFunctionsOf()
{
import std.traits;
string
void main()
{
class Foo
{
void fun(){}
}
foreach(m; __traits(allMembers, Foo))
foreach(sym; __traits(getOverloads, Foo, m))
{
}
}
this fails with:
onlineapp.d(9): Error: no property this for type
onlineapp.main.Foo
onlineapp.d(9): Error: (Foo).this cannot
On Monday, 5 March 2018 at 14:50:54 UTC, Adam D. Ruppe wrote:
No, ddoc does not support that. You might be able to hack it
with javascript though.
thanks, yeah eigther that or a d script to do some
postprocessing, so it can work without javascript.
///
void fun(){}
///$(TABLE $(TR $(TD Back to:) $(TD href="#fun">Declaration) $(TD $(LINK2 #top, Top
unittest
{
}
it basically should look like this:
Declaration
void fun()
Example
---
---
[Back to:] [Declaration] [Top]
and if i replace the embbeded html with $(LINK2 #fun,
On Sunday, 4 March 2018 at 21:47:43 UTC, Jonathan M Davis wrote:
On Sunday, March 04, 2018 21:03:23 arturg via
Digitalmars-d-learn wrote:
isn't this what DIP 1005 tried to solve?
No. What DIP 1005 was trying to solve was avoiding having to
have imports used by your function signature
On Sunday, 4 March 2018 at 21:03:04 UTC, JN wrote:
Imagine a function like this:
void printValue(T)(string name, T value)
{
writeln(name, " = ", value);
}
int x = 10;
printValue("x", x);
is it somehow possible to convert that printValue into a mixin
or something, so I could do something
On Sunday, 4 March 2018 at 19:58:14 UTC, ag0aep6g wrote:
On 03/04/2018 08:54 PM, aliak wrote:
wait a minute... so I can't use any std.range functions on a
type if I add the range primitives as free functions? O.o
Yes. In other words: You can't implement range primitives as
free functions.
On Sunday, 4 March 2018 at 20:07:06 UTC, visitor wrote:
On Sunday, 4 March 2018 at 19:53:59 UTC, ag0aep6g wrote:
On 03/04/2018 08:45 PM, ag0aep6g wrote:
I don't know what's going on here. The error message doesn't
make sense to me. Might be a bug in the compiler.
This one works:
struct
I had the same issue, happens with any conflicting selective
import.
It seems to work if you dont use selective imports, but importing
it inside the function if possible is a better option.
On Saturday, 3 March 2018 at 18:28:42 UTC, aliak wrote:
On Friday, 2 March 2018 at 19:47:23 UTC, SimonN wrote:
If you know of other ways though I'm all ears :)
Cheers
maybe not exactly what you want, but here are some templates i
wrote a while ago which basically are a more flexible form of
On Saturday, 3 March 2018 at 16:20:57 UTC, JN wrote:
https://run.dlang.io/gist/ec7008372d60ac52460dd58068f1ca6d?compiler=dmd
Why only listUDA2 works and listUDA doesn't? Why do I need to
use __traits(getMember again, if I use what I saved in a
variable, it doesn't work :(
because getUDAs
On Sunday, 18 February 2018 at 13:08:09 UTC, thorstein wrote:
On Sunday, 18 February 2018 at 12:51:04 UTC, thorstein wrote:
// Solution 1
foreach(row; arr)
{ foreach(col; row)
{ col[] *= skalar;
}
}
return arr;
// Solution 2
import std.array;
return array(arr.map!(b => array(b[].map!(c =>
double[][] skalar_m_2d(double[][] arr, double skalar)
{
import std.algorithm;
// return arr.map(a=> a[] *= skalar).array;
arr.each!((ref a) => a[] *= skalar));
return arr;
}
On Friday, 16 February 2018 at 13:57:07 UTC, Steven Schveighoffer
wrote:
You have a pretty good minimal test, put that in bugzilla along
with the forum thread link and all the info we know. Mark it as
a dmd bug, regression, along with the version where it
regressed (2.076.1), and I would tag
On Friday, 16 February 2018 at 13:28:59 UTC, Steven Schveighoffer
wrote:
Strictly speaking, this is not necessarily proof that it's in
phobos, there could have been changes elsewhere that cause one
of the conditions to fail.
However, testing this out, I found something very weird.
If you
On Friday, 16 February 2018 at 11:45:21 UTC, arturg wrote:
this code fails to compile:
void delegate(void*) dg;
void delegate(void*)[] dgs = [dg, dg, dg];
dgs.writeln;
dgs.remove(1).writeln();
if you comment out dgs.writeln; it works as expected,
it works if you use other types
this code fails to compile:
void delegate(void*) dg;
void delegate(void*)[] dgs = [dg, dg, dg];
dgs.writeln;
dgs.remove(1).writeln();
if you comment out dgs.writeln; it works as expected,
it works if you use other types then void*:
void delegate(int*) dg;
void
On Sunday, 28 January 2018 at 17:51:19 UTC, Jonathan M Davis
wrote:
Hmm. Thanks. I'll have to check that out. I haven't done
anything with folds in ages.
Fortunately, I don't have to do anything with python right now
though. The main reason that I used it before was so that I
could have
On Sunday, 28 January 2018 at 16:02:36 UTC, Jonathan M Davis
wrote:
Erm, you do realize that Vim has built-in commands for
navigating nested brackets and parentheses, right? And
automatic bracket closing is just a macro away. You don't even
need a plugin for that.
LOL. One of the reasons
On Wednesday, 17 January 2018 at 17:37:07 UTC, H. S. Teoh wrote:
On Wed, Jan 17, 2018 at 05:31:03PM +, Azi Hassan via
Digitalmars-d-learn wrote:
The D tour for structs uses a syntax similar to that of C++ in
order to initialize a Person struct : Person p(30, 180). Is
this syntax supported
On Friday, 29 September 2017 at 18:03:52 UTC, Joseph wrote:
static if ()
{
enum x;
}
static if (isDefined!x)
{
}
What's the correct way to check if a variable has been defined?
(note x may or may not be defined above. I need to know if it
is)
import std.traits;
static if(hasMember!(T,
On Thursday, 28 September 2017 at 20:17:24 UTC, Ali Çehreli wrote:
On 09/28/2017 12:18 PM, dark777 wrote:
On Thursday, 28 September 2017 at 18:46:56 UTC, Ali Çehreli
wrote:
On 09/28/2017 08:13 AM, dark777 wrote:
no print function output do while
in my program after entering the data and
On Wednesday, 19 July 2017 at 16:00:56 UTC, Piotr Mitana wrote:
Hello, I have this code:
immutable class Base
{
this() {}
}
immutable class Derived : Base {}
void main()
{
new immutable Derived();
}
I'd like class Derived to automatically inherit the default
constructor from
On Monday, 26 June 2017 at 14:30:13 UTC, Mike Parker wrote:
I've just published a wall of text about Derelict. I don't
think I've ever written so much about it in one sitting, so it
was a fun post to write. As well as (the reminder of how fast
time is slipping away aside) a nice walk down
On Monday, 12 June 2017 at 19:51:37 UTC, Gary Willoughby wrote:
I don't know how H. S. Teoh managed to answer 'before' I posted
but thanks guys! :)
might be a bug, happened here
http://forum.dlang.org/post/ohbr5l$2mng$1...@digitalmars.com also.
On Tuesday, 23 May 2017 at 17:28:21 UTC, MysticZach wrote:
I made a pull request for a new DIP dealing with contract
syntax:
https://github.com/dlang/DIPs/pull/66
I write the DIP in response to the discussions for DIP 1003:
http://forum.dlang.org/thread/wcqebjzdjxldeywlx...@forum.dlang.org
On Sunday, 30 April 2017 at 05:53:09 UTC, Andrew Edwards wrote:
string line;
parse!int((line = readln)).writeln;
is there a reason you mix normal call and ufc or just some style?
you can do this and remove some ()
(line = readln).parse!int.writeln;
On Sunday, 23 April 2017 at 12:03:47 UTC, Andrei Alexandrescu
wrote:
On 4/22/17 4:52 PM, Joakim wrote:
On Saturday, 22 April 2017 at 11:54:08 UTC, Mike Parker wrote:
DIP 1005 is titled "Dependency-Carrying Declarations".
https://github.com/dlang/DIPs/blob/master/DIPs/DIP1005.md
All
On Friday, 30 December 2016 at 23:49:23 UTC, Andrei Alexandrescu
wrote:
The main win, which indeed is not emphasized enough, is better
encapsulation. Walter pointed that out, and I will redo the DIP
to put that front and center.
Maybe i can provide an example where i think DCD's would be
On Thursday, 15 December 2016 at 19:52:50 UTC, Andrei
Alexandrescu wrote:
On 12/15/2016 02:22 PM, Timothee Cour via Digitalmars-d wrote:
Some more details on my proposa based on UDA:
...
I now understand the idea, thank you.
My question is, doesn't this take things too far? Earlier I
On Wednesday, 14 December 2016 at 22:56:54 UTC, Andrei
Alexandrescu wrote:
The acceptability of the proposal decays exponentially with its
deviation from existing import syntax. -- Andrei
sorry, i missed the import keyword :/
T1 fun(T1, T2)(T1 t1, T2 t2)
import
{
version(A)
{
On Wednesday, 14 December 2016 at 19:39:55 UTC, Andrei
Alexandrescu wrote:
On 12/14/2016 02:04 PM, Meta wrote:
On Wednesday, 14 December 2016 at 17:32:10 UTC, H. S. Teoh
wrote:
What about:
/* Showing full declaration just for context */
bool myFunc(R1, R2)(R1 r1, R2 r2)
import {
My issue isn't about @property, it just shows 3 cases where i
think that dmd is missing a check for alias this.
Even if D didnt had @property or parentesis less function call,
due to alias opCall this it should be possible to call opCall
without parentesis.
On Thursday, 8 December 2016 at 22:46:32 UTC, Jonathan M Davis
wrote:
On Thursday, December 08, 2016 22:11:22 ArturG via
Digitalmars-d-learn wrote:
On Thursday, 8 December 2016 at 16:54:57 UTC, Adam D. Ruppe
wrote:
> On Thursday, 8 December 2016 at 16:53:13 UTC, Satoshi wrote:
>> is
On Thursday, 8 December 2016 at 16:54:57 UTC, Adam D. Ruppe wrote:
On Thursday, 8 December 2016 at 16:53:13 UTC, Satoshi wrote:
is there any advantage of marking function as @property??
Not really. I think it just changes the meaning of
typeof(thatfunc) but otherwise it does nothing.
alias PSC = ParameterStorageClass;
alias PSCT = ParameterStorageClassTuple;
void fun1(return ref int){}
void fun2(return out int){}
PSCT!fun1 == (PSC.return_ | PSC.ref_) // false
PSCT!fun2 == (PSC.return_ | PSC.out_) // false
PSCT!fun1 == PSC.return_ // true
PSCT!fun2 == PSC.return_ // true
On Sunday, 4 December 2016 at 20:44:05 UTC, Jonathan M Davis
wrote:
On Sunday, December 04, 2016 15:30:22 vladdeSV via
Digitalmars-d-learn wrote:
Hello!
I have a question not directly related to D as it is with
coding standards.
My issue at hand is if I have one variable for a class, which
a simple example:
mixin template v1()
{
void foo(){}
}
mixin template v2()
{
void foo(int){}
}
class Test
{
mixin v1;
mixin v2;
}
void main()
{
__traits(getOverloads, Test, "foo").length.writeln; // 0
}
i know you can use alias to manually make them visible for
On Thursday, 3 November 2016 at 22:29:34 UTC, Jerry wrote:
So I was thinking of a way of extending if statements that have
declarations. The following being as example of the current use
of if statements with declarations:
if(int* weDontPollute = someFunc())
{
// use
On Sunday, 30 October 2016 at 18:10:09 UTC, Nordlöw wrote:
Is there a recommended way to create a builtin D array with a
given capacity?
I'm aware of the `.capacity` property.
Is it ok to mutate it?
you cant mutate capacity directly because its only a getter but
you could use
On Friday, 21 October 2016 at 02:40:45 UTC, Stefan Koch wrote:
On Friday, 21 October 2016 at 02:16:44 UTC, Chris M. wrote:
So I know you can do some pattern matching with templates in
D, but has there been any discussion about implementing it as
a language feature, maybe something similar to
On Monday, 5 September 2016 at 18:07:52 UTC, pineapple wrote:
It works like this:
try:
do_something()
except Exception as e:
pass # Runs when an error inheriting from Exception was
raised
else:
pass # Runs when no error was raised
finally:
pass
On Sunday, 24 July 2016 at 18:38:53 UTC, Eppason wrote:
The obvious solution is to refactor Bar, but in the real world,
it is much harder and life would be much easier if I could
remove foo from exists inside S. At worse, if Bar did depend on
foo, I would simply get errors about missing
On Sunday, 26 June 2016 at 11:23:14 UTC, Márcio Martins wrote:
Consider this snippet:
struct X {
int foo(Args...)(Args args) if (Args.length > 1) { return
Args.length; }
int foo() { return 0; }
int foo(int y) { return 1; }
alias Name = string;
int field_;
}
void
http://melpon.org/wandbox/permlink/u8lpOZ9owC7QXfa3
hi, that code is based on ideas and code from this[1] thread.
some examples:
// named and in order
args!(fun, a=>6, b=>65, s=>"test", f=>1.4);
// named and out of order
args!(fun, b=>65, f=>1.4, s=>"test", a=>6);
// unnamed and in
On Saturday, 11 June 2016 at 15:46:59 UTC, Vladimir Panteleev
wrote:
Taking an address creates a function pointer, which loses the
argument names. (Doesn't it?)
unfortunatly yes, but it works as a struct or class initializer
https://dpaste.dzfl.pl/6aad852aea90
On Saturday, 11 June 2016 at 14:26:20 UTC, Atila Neves wrote:
Why? Because I could, I don't plan on using this for anything
serious. I think "with" is my favourite D feature right now. I
also wrote the Writer and State monads (not that D needs them):
https://github.com/atilaneves/felix
On Saturday, 11 June 2016 at 09:07:43 UTC, Andrei Alexandrescu
wrote:
No, both are nice to have. If one name is needed for both,
"args" is indeed a good commonality. "Invoke function f with
these args" and "Construct an object of type T with these
args". The problem is it's not very
you could also use a simple wrapped cast
Ret castTo(Ret, T)(T t) if(is(T == class))
{
return cast(Ret) t;
}
then do
foo.stuff[0].castTo!Dong.x.writeln;
and if you want to guard the access you could try
foo.stuff[0].castTo!Dong.cc!((d){d.x = 5;});
cc is an alias for checkCall which is a
On Friday, 10 June 2016 at 17:32:03 UTC, Steven Schveighoffer
wrote:
Consider:
import std.traits;
class Foo
{
void bar() {}
void baz()() {}
}
This works:
static assert(isCallable!(Foo.bar));
This does not:
static assert(isCallable!(Foo.baz));
However, clearly I can call baz due to
is it supposed to work?
normally it works e.g.
assert(0, "some\nstring");
prints:
some
string
but if you do it inside a template constraint like this:
void someTemp(T)(T t) if(isCallable!T.call!((b){assert(b,
"some\nstring");}))
{
}
it prints:
some\x0astring
this is a library implementation based on the with expression[1]
idea
i posted a while ago and is kinda related to the ?. operator.
as we cant fully implement the above idea as a library i tried to
do
what's possible which are basically chainable scopes[2].
implemented as 2 templates:
On Friday, 27 May 2016 at 14:48:59 UTC, Adam D. Ruppe wrote:
On Friday, 27 May 2016 at 14:43:47 UTC, ArturG wrote:
if(value is typeof(value).init) ...
that still requiers a special case for floating points, arrays
and optionally empty string literals.
Have you tried? That should work
On Friday, 27 May 2016 at 18:03:23 UTC, Steven Schveighoffer
wrote:
I didn't change the default. The default is to pick the first
member and use that as the init value. I may not have even
considered what foo.init might be when I was creating my enum.
-Steve
by default i ment this
enum
On Friday, 27 May 2016 at 16:56:21 UTC, Steven Schveighoffer
wrote:
Why are you expecting it to be?
Won't work for enums with first elements that are non-zero
either:
enum foo : int {
bar = 1;
}
foo f;
if(f) writeln("this will output too");
-Steve
but by default it works you just
On Friday, 27 May 2016 at 15:24:18 UTC, Adam D. Ruppe wrote:
On Friday, 27 May 2016 at 15:19:50 UTC, ArturG wrote:
yes but i have to check for that when some one does
Why? This is no different than if they set any of the other
four billion possible values.
What do you mean?
operation on
On Friday, 27 May 2016 at 15:07:50 UTC, Adam D. Ruppe wrote:
On Friday, 27 May 2016 at 14:56:28 UTC, ArturG wrote:
float f;
if(f is float.init) "float init".writeln;
f = float.nan;
if(f is float.init) "float nan".writeln;
You changed it to a value that isn't float.init, so of
On Friday, 27 May 2016 at 14:48:59 UTC, Adam D. Ruppe wrote:
On Friday, 27 May 2016 at 14:43:47 UTC, ArturG wrote:
if(value is typeof(value).init) ...
that still requiers a special case for floating points, arrays
and optionally empty string literals.
Have you tried? That should work
On Friday, 27 May 2016 at 09:25:55 UTC, Marc Schütz wrote:
On Thursday, 26 May 2016 at 16:45:22 UTC, ArturG wrote:
im just playing with this template[1] is there anything else i
missed? (if you dont mind)
it basically treats any T.init as false and skips the
function/delegate and just returns
On Thursday, 26 May 2016 at 15:51:39 UTC, Basile B. wrote:
Oh, I'm so sorry ! I totally missed the point of the Q.
float.nan is not a "unique" value. Several values verify "nan"
(Look at std.math.isNan). So I suppose it's simpler to test
for nullity. Though with the sign there's also two
On Thursday, 26 May 2016 at 15:38:55 UTC, Basile B. wrote:
because nan is not 0 and that the shortcut for float is
if (fpValue) <=> if (fpValue != 0)
if (!fpValue)<=> if (fpValue == 0)
There's no relation between the initializer and the shortcut.
It's not because for some values the
On Thursday, 26 May 2016 at 15:29:52 UTC, Basile B. wrote:
float.init is not equal to 0.0f. In D FP points values are
initialized to nan (not a number).
By the way for strings it works, it's like the array case I
described in the first answer).
yes i guess i tested all/most types and
On Thursday, 26 May 2016 at 15:25:26 UTC, ag0aep6g wrote:
On 05/26/2016 04:03 PM, ArturG wrote:
for example:
if(any floatingpoint.init) will be true
if(any char.init) also true
if("") also true
while others are false e.g.
string s;
if(s) will be false
all others are also false or did i miss
On Thursday, 26 May 2016 at 15:15:57 UTC, Basile B. wrote:
On Thursday, 26 May 2016 at 15:14:21 UTC, Basile B. wrote:
On Thursday, 26 May 2016 at 15:11:50 UTC, Basile B. wrote:
On Thursday, 26 May 2016 at 14:03:16 UTC, ArturG wrote:
[...]
[...]
- integral(*): if (i) <=> if (i > 0)
I
On Thursday, 26 May 2016 at 14:12:23 UTC, chmike wrote:
I couldn't find any information about this on the dlang web
site.
What is the effect adding the immutable attribute to a class
like this
immutable class MyClass { ... }
The compiler doesn't complain.
Will it add the immutable
for example:
if(any floatingpoint.init) will be true
if(any char.init) also true
if("") also true
while others are false e.g.
string s;
if(s) will be false
all others are also false or did i miss any?
On Wednesday, 25 May 2016 at 00:36:04 UTC, Seb wrote:
On Tuesday, 24 May 2016 at 19:03:11 UTC, ArturG wrote:
would something like this be usefull?
A general word of advice - try to keep your post short &
concise. It is more likely to get replies then.
Yes i might have used to many
ive read some discussions about some library solution for the ?.
operator,
has there been anything added to phobos?
wouldnt a checked with expression be a more general/longer form
of the ?. operator?
A with expression not only allows you to do unchecked/checked
access to members but to any
On Thursday, 24 March 2016 at 08:24:46 UTC, Edwin van Leeuwen
wrote:
JSONValue only works with the build in types, not with user
defined types. Either you define a specific function for the
class that returns a JSONValue. Easiest way to do that would be
to build an associative array with
hi, has the UDA syntax been proposed already?
void fun(int foo, int bar, int bazDaz = 0){}
fun(10, 30, 50); // normal
fun(10, 30); normal with default
fun(10, 30, @bazDaz 50); // mixed
fun(@bazDaz 50, 10, 30) // mixed and reordered
fun(@bar 30, 10); // mixed, reordered and default
fun(@foo
On Monday, 25 January 2016 at 08:55:55 UTC, Jacob Carlborg wrote:
On 2016-01-24 19:23, Chris Wright wrote:
It shouldn't. However, it is another way to pass function
arguments, so
for thoroughness it would be better to mention it.
Added an example.
Is this what you intended? If so, please
On Monday, 25 January 2016 at 13:40:18 UTC, HaraldZealot wrote:
On Saturday, 23 January 2016 at 14:19:03 UTC, Jacob Carlborg
wrote:
This is mostly to prevent ugly hacks like Flag [1].
http://wiki.dlang.org/DIP88
[1] https://dlang.org/phobos/std_typecons.html#.Flag
Why not simply allow
On Monday, 25 January 2016 at 16:50:49 UTC, HaraldZealot wrote:
On Monday, 25 January 2016 at 14:35:09 UTC, arturg wrote:
On Monday, 25 January 2016 at 13:40:18 UTC, HaraldZealot wrote:
the equal sign cant be used because D behaves like this
int width, height;
foo(width = 5, height = 10); //
On Monday, 25 January 2016 at 16:17:27 UTC, Chris Wright wrote:
It's a comment that the compiler verifies. You could argue that
the bulk of the type system is comments that the compiler
verifies.
named arguments solve this problem
void foo(int a = 4, int b = 10, int c = 3) {}
foo(c : 5);
On Friday, 22 January 2016 at 06:53:29 UTC, mzf wrote:
D code:
auto arr = ["b1=1", "b=2","a1=1", "a=2"];
writeln(arr.sort());
output:["a1=1", "a=2", "b1=1", "b=2"]
C# code:
var arr = new string[]{ "b1=1", "b=2", "a1=1", "a=2" };
Array.Sort(arr);
output:["a=2","a1=1","b=2","b1=1"]
auto
96 matches
Mail list logo