On Wednesday, 22 August 2018 at 08:33:36 UTC, Andrey wrote:
Hello,
I know that D has build-in unit tests. If so, what mechanism D
provides for mocking objects?
For example:
struct WebParser
{
// ...
int download(string path)
{
SomeHttpClient client(path);
auto result =
On Wednesday, 22 August 2018 at 15:18:29 UTC, XavierAP wrote:
On Wednesday, 22 August 2018 at 14:48:57 UTC, Alex wrote:
Because it could be meant as the argument to some templates to
the left. Like
(foo!bar)!x
Sure, it would be a coincidence, if both will work. However,
templates are not
On Wednesday, 22 August 2018 at 14:48:57 UTC, Alex wrote:
Because it could be meant as the argument to some templates to
the left. Like
(foo!bar)!x
Sure, it would be a coincidence, if both will work. However,
templates are not something where you can simply imply the
associative property,
On Wednesday, 22 August 2018 at 14:30:39 UTC, XavierAP wrote:
Why
foo!bar!x
is not understood as
foo!(bar!x)
but instead gives an error "multiple ! arguments are not
allowed"?
Precisely because multiple "!" can never belong to the same
instantiation, why does the parser not
Why
foo!bar!x
is not understood as
foo!(bar!x)
but instead gives an error "multiple ! arguments are not allowed"?
Precisely because multiple "!" can never belong to the same
instantiation, why does the parser not understand without needing
brackets that the rightmost
On Wednesday, 22 August 2018 at 13:50:07 UTC, Andrey wrote:
Hello,
How to test if variable has void value?
string text = void;
if(text == void)
{
writeln("Is void");
}
Tried this:
if(is(text == void))
but doesn't work.
You can't. When using a void initializer the actual value is
Hello,
How to test if variable has void value?
string text = void;
if(text == void)
{
writeln("Is void");
}
Tried this:
if(is(text == void))
but doesn't work.
On Wednesday, 22 August 2018 at 12:36:39 UTC, Simen Kjærås wrote:
Since both your opOpAssigns match equally, the compiler throws
up. The solution is to add some sort of restriction:
This doesn't happen apparently: the operator has a left and a
right side, even if both types define the
On Wednesday, 22 August 2018 at 13:20:01 UTC, aliak wrote:
"void opOpAssign(string op, T)(ref Tthis, const ref T x)" looks
like the wrong signature for opOpAssign.
Oh I'll put on my stupid hat now...
I realize I had copy-pasted the wrong syntax from the global
function attempt, but I swear
On Wednesday, 22 August 2018 at 11:58:25 UTC, XavierAP wrote:
I've been trying some things to template operator overloads.
The reason is that I want very similar code for different
types, but I can't use polymorphism, as they're structs rather
than classes. Perhaps this choice is not as
On Wednesday, 22 August 2018 at 11:58:25 UTC, XavierAP wrote:
When I want to have the same operator overloading code in both
types however, I can't make it work:
From https://dlang.org/spec/operatoroverloading.html#binary:
"the one with the ‘better’ match is selected. It is an error for
both
I've been trying some things to template operator overloads. The
reason is that I want very similar code for different types, but
I can't use polymorphism, as they're structs rather than classes.
Perhaps this choice is not as advantageous as I think, and I may
change this design from structs
On Wednesday, 22 August 2018 at 10:36:32 UTC, Andrey wrote:
Hello,
Is there a template/function/mixin... in the library that I can
use to map elements of a tuple?
object.foo(Mapper!myMapFunction(1, bool, "Qwerty",
EnumedColor.Red));
where "Mapper" is this mapper and "myMapFunction" is a
On Wed, 2018-08-22 at 06:14 +, binghoo dang via Digitalmars-d-learn
wrote:
[…]
> yeah, Diamond is great, but I think it will be more wonderful if
> it's database ORM can be separated to a standalone project,
> that's would be useful for the application that's is not WEB
> oriented but need
On Wednesday, 22 August 2018 at 10:36:32 UTC, Andrey wrote:
Hello,
Is there a template/function/mixin... in the library that I can
use to map elements of a tuple?
object.foo(Mapper!myMapFunction(1, bool, "Qwerty",
EnumedColor.Red));
where "Mapper" is this mapper and "myMapFunction" is a
Hello,
Is there a template/function/mixin... in the library that I can
use to map elements of a tuple?
object.foo(Mapper!myMapFunction(1, bool, "Qwerty",
EnumedColor.Red));
where "Mapper" is this mapper and "myMapFunction" is a template
function that I want to apply to each member in
On Tuesday, 21 August 2018 at 21:29:38 UTC, Andrey wrote:
Hello,
This is a code:
(...)
test.handler =
That's an internal pointer, and internal pointers are not allowed
in structs precisely because of the issues you're running into:
the pointer will be invalid after a move.
On Wednesday, 22 August 2018 at 06:14:40 UTC, binghoo dang wrote:
On Tuesday, 21 August 2018 at 10:48:30 UTC, bauss wrote:
Currently (When I get time again) working on implementing
PostgreSQL and Sqlite support for Diamond.
Mysql and Mssql should work out the box.
On Wednesday, 22 August 2018 at 09:33:26 UTC, bauss wrote:
I would suggest
Accidentally pressed "Send", but as I was saying.
I would suggest https://github.com/buggins/hibernated as an
alternative.
On Wednesday, 22 August 2018 at 08:33:36 UTC, Andrey wrote:
Hello,
I know that D has build-in unit tests. If so, what mechanism D
provides for mocking objects?
For example:
struct WebParser
{
// ...
int download(string path)
{
SomeHttpClient client(path);
auto result =
On Tuesday, 21 August 2018 at 21:37:00 UTC, QueenSvetlana wrote:
I had a misunderstanding about the keyword auto because I
wrongfully believed that it made the code like Python
Exactly, you are thinking still like D is Python or also
dynamically typed. :) You will get when compiling errors
Hello,
I know that D has build-in unit tests. If so, what mechanism D
provides for mocking objects?
For example:
struct WebParser
{
// ...
int download(string path)
{
SomeHttpClient client(path);
auto result = client.request(path, 10, "Qwerty");
// ...
On Wednesday, 22 August 2018 at 07:03:02 UTC, Andrey wrote:
but it is ugly...
You can write a type that will hide it.
On Wednesday, 22 August 2018 at 07:03:02 UTC, Andrey wrote:
On Tuesday, 21 August 2018 at 22:52:31 UTC, Alex wrote:
Maybe, like this:
Thank you but here you use heap to create ab object. I want
only on stack.
I know that one can do this:
test_handler.ptr = null;
and in place of call this:
On Tuesday, 21 August 2018 at 22:52:31 UTC, Alex wrote:
Maybe, like this:
Thank you but here you use heap to create ab object. I want only
on stack.
I know that one can do this:
test_handler.ptr = null;
and in place of call this:
handler.ptr = cast(void*)
but it is ugly...
Hmm, any
On Tuesday, 21 August 2018 at 08:22:34 UTC, Russel Winder wrote:
If there was a D version of SQLAlchemy, that would be
wonderful. Feel free to s/TBA/Russel Winder/
Great! there are many people waiting for this! ^_^
On Tuesday, 21 August 2018 at 10:48:30 UTC, bauss wrote:
Currently (When I get time again) working on implementing
PostgreSQL and Sqlite support for Diamond.
Mysql and Mssql should work out the box.
https://github.com/DiamondMVC/Diamond
Some examples will come later, unless you use the
27 matches
Mail list logo