On Tuesday, 25 July 2017 at 02:18:41 UTC, Adam D. Ruppe wrote:
On Tuesday, 25 July 2017 at 02:11:20 UTC, NoBigDeal256 wrote:
it passes when it should fail because the unittest block is
never executed. Why is this?
Did you actually instantiate the class somewhere? A template
has no concrete
On Tuesday, 25 July 2017 at 02:18:41 UTC, Adam D. Ruppe wrote:
On Tuesday, 25 July 2017 at 02:11:20 UTC, NoBigDeal256 wrote:
it passes when it should fail because the unittest block is
never executed. Why is this?
Did you actually instantiate the class somewhere? A template
has no concrete
On Tuesday, 25 July 2017 at 02:11:20 UTC, NoBigDeal256 wrote:
it passes when it should fail because the unittest block is
never executed. Why is this?
Did you actually instantiate the class somewhere? A template has
no concrete code unless created with an argument somewhere...
For example this code:
class Test {
unittest {
assert(false);
}
}
fails when ran with dmd test.d -unittest like you'd expect. But
if I make it a class template:
class Test(T) {
unittest {
assert(false);
}
}
it passes when it should fail because the unittest
On Monday, 24 July 2017 at 22:15:05 UTC, dark777 wrote:
Eu tenho um projeto em windows form C# feito no virual studio
um amigo meu e eu criamos para a semana academica ele faz
cadastros e marca a presença das visitas na semana por um id de
quem ja pagou pelas palestras queria portar ele para
On 24.07.2017 20:19, Suliman wrote:
Why D have two function `contains` and `canFind`
`contains` guarantees logarithmic running time, while `canFind` can be
linear.
Eu tenho um projeto em windows form C# feito no virual studio um
amigo meu e eu criamos para a semana academica ele faz cadastros
e marca a presença das visitas na semana por um id de quem ja
pagou pelas palestras queria portar ele para D.
Que biblioteca para forms vcs me recomendam para
Hi,
I want to validate whether a class contains a specific attribute.
I have the attribute name as compile time string. This string
could either be a direct attribute of the class or a hierarchy
(TextSettings.Font.Size).
As example T is the class Label and p.name contains the text
On Monday, 24 July 2017 at 20:33:42 UTC, dark777 wrote:
On Monday, 24 July 2017 at 20:06:37 UTC, ag0aep6g wrote:
On 07/24/2017 09:45 PM, dark777 wrote:
principal.d(18): Error: octal literals 01023040 are no longer
supported, use std.conv.octal!1023040 instead
Failed: ["dmd", "-v", "-o-",
On Monday, 24 July 2017 at 20:06:37 UTC, ag0aep6g wrote:
On 07/24/2017 09:45 PM, dark777 wrote:
principal.d(18): Error: octal literals 01023040 are no longer
supported, use std.conv.octal!1023040 instead
Failed: ["dmd", "-v", "-o-", "principal.d", "-I."]
[...]
https://pastebin.com/CYinHWyQ
On Monday, 24 July 2017 at 19:53:34 UTC, Cym13 wrote:
On Monday, 24 July 2017 at 18:31:09 UTC, Ali Çehreli wrote:
On 07/24/2017 11:19 AM, Suliman wrote:
> [...]
only
> [...]
std.algorithm.canFind and std.range.SortedRange.contains:
[...]
I'm gessing this predates design by introspection as
On Monday, 24 July 2017 at 20:14:23 UTC, SrMordred wrote:
On Monday, 24 July 2017 at 19:45:03 UTC, dark777 wrote:
pessoal eu tenho umas classes java e estava portando para D e
para usar as importaçoes criei os modules nescessarios todos
estao dentro da mesma pasta porem ao fazer:
$rdmd
On Monday, 24 July 2017 at 19:45:03 UTC, dark777 wrote:
pessoal eu tenho umas classes java e estava portando para D e
para usar as importaçoes criei os modules nescessarios todos
estao dentro da mesma pasta porem ao fazer:
$rdmd principal
ele retorna o seguinte erro:
principal.d(18): Error:
On 07/24/2017 09:45 PM, dark777 wrote:
principal.d(18): Error: octal literals 01023040 are no longer supported,
use std.conv.octal!1023040 instead
Failed: ["dmd", "-v", "-o-", "principal.d", "-I."]
[...]
https://pastebin.com/CYinHWyQ
From there:
e = new Endereco();
On Monday, 24 July 2017 at 18:31:09 UTC, Ali Çehreli wrote:
On 07/24/2017 11:19 AM, Suliman wrote:
> [...]
only
> [...]
std.algorithm.canFind and std.range.SortedRange.contains:
[...]
I'm gessing this predates design by introspection as it would be
cleaner to let the compiler do the switch
On Monday, 24 July 2017 at 19:45:03 UTC, dark777 wrote:
pessoal eu tenho umas classes java e estava portando para D e
para usar as importaçoes criei os modules nescessarios todos
estao dentro da mesma pasta porem ao fazer:
$rdmd principal
ele retorna o seguinte erro:
principal.d(18): Error:
pessoal eu tenho umas classes java e estava portando para D e
para usar as importaçoes criei os modules nescessarios todos
estao dentro da mesma pasta porem ao fazer:
$rdmd principal
ele retorna o seguinte erro:
principal.d(18): Error: octal literals 01023040 are no longer
supported, use
On Monday, 24 July 2017 at 18:15:20 UTC, Steven Schveighoffer
wrote:
On 7/24/17 1:29 PM, Dgame wrote:
Why isn't the compiler able to deduce S[] => I[]? Or is it
just me?
I've tried dmd 2.075
I know you got the explanation already, but just in case you
actually need to call something like
On 07/24/2017 11:19 AM, Suliman wrote:
> Why D have two function `contains` and `canFind` if C# have only
> contains and it's enough?
std.algorithm.canFind and std.range.SortedRange.contains:
https://dlang.org/phobos/std_algorithm_searching.html#.canFind
On Monday, 24 July 2017 at 18:01:19 UTC, ketmar wrote:
Clinton wrote:
On Monday, 24 July 2017 at 14:51:04 UTC, rikki cattermole
wrote:
Stuff the GC.
You don't need it to care about collecting (or destroying for
that matter).
Tell it to free[0] the array directly.
```D
T[] array;
On 7/24/17 1:11 PM, Martin Tschierschke wrote:
When I tried to set the atime and mtime of a file (f) via:
import std.datetime;
auto time = Clock.currTime();
setTimes(f,time,time);
I get "Operation not permitted."
This is caused on linux by the rule, that if you are not the owner of
the file
Why D have two function `contains` and `canFind` if C# have only
contains and it's enough?
On 7/24/17 1:29 PM, Dgame wrote:
Why isn't the compiler able to deduce S[] => I[]? Or is it just me?
I've tried dmd 2.075
I know you got the explanation already, but just in case you actually
need to call something like test1 but only have an S[]:
test1(ss.map!((I i) => i).array)
-Steve
Clinton wrote:
On Monday, 24 July 2017 at 14:51:04 UTC, rikki cattermole wrote:
Stuff the GC.
You don't need it to care about collecting (or destroying for that
matter).
Tell it to free[0] the array directly.
```D
T[] array;
GC.free(array.ptr);
```
Normally I would suggest to create your
On Monday, 24 July 2017 at 17:33:48 UTC, Adam D. Ruppe wrote:
On Monday, 24 July 2017 at 17:29:55 UTC, Dgame wrote:
S[] ss = [new S()];
test1(ss); // Fails
Why isn't the compiler able to deduce S[] => I[]? Or is it
just me?
This is exactly because of polymorphism. Consider
On Monday, 24 July 2017 at 14:51:04 UTC, rikki cattermole wrote:
Stuff the GC.
You don't need it to care about collecting (or destroying for
that matter).
Tell it to free[0] the array directly.
```D
T[] array;
GC.free(array.ptr);
```
Normally I would suggest to create your own buffer, but
On 7/24/17 11:45 AM, Houdini wrote:
On Monday, 24 July 2017 at 15:41:33 UTC, Steven Schveighoffer wrote:
Because types with inheritance generally don't work right if you pass
by value (i.e. the slicing problem).
structs don't support inheritance or virtual functions, so they can be
safely
Hello
I'm trying to move forward with my code from here:
https://forum.dlang.org/post/yftgpzlotuqzechcn...@forum.dlang.org
I create my client app and trying to use RestInterfaceClient to
connect to my api. Here is my present code for client:
module sites.frontpage;
import vibe.d;
import
On Monday, 24 July 2017 at 17:29:55 UTC, Dgame wrote:
S[] ss = [new S()];
test1(ss); // Fails
Why isn't the compiler able to deduce S[] => I[]? Or is it just
me?
This is exactly because of polymorphism. Consider the following:
```
S[] ss = [new S()];
I[] i = ss; // pass it
I may be just tired, but could somebody explain this behaviour to
me? It seems odd to me:
interface I
{
}
class S : I
{
}
void test1(I[])
{
}
void test2(I)
{
}
void main()
{
test1([new S()]); // Works
test2(new S()); // Works
I i = new S();
When I tried to set the atime and mtime of a file (f) via:
import std.datetime;
auto time = Clock.currTime();
setTimes(f,time,time);
I get "Operation not permitted."
This is caused on linux by the rule, that if you are not the
owner of the file
you may only set the mtime of a file to current
On 22.07.2017 22:55, kerdemdemir wrote:
We have awesome way for creating slices like:
a = new int[5];
int[] b = a[0..2];
But what about if I have 2D array and I don't want to go vertical.
Something like :
int[3][3] matrix = [
[ 1, 2, 3 ],
[ 4, 5, 6 ],
[ 7, 8, 9 ]
];
On Monday, 24 July 2017 at 14:51:04 UTC, rikki cattermole wrote:
Stuff the GC.
You don't need it to care about collecting (or destroying for
that matter).
Tell it to free[0] the array directly.
```D
T[] array;
GC.free(array.ptr);
```
Normally I would suggest to create your own buffer, but
On Mon, Jul 24, 2017 at 03:45:29PM +, Houdini via Digitalmars-d-learn wrote:
> But in C++, we pass them by reference also to avoid copies (const &).
Exactly... in C++ you basically always pass by reference, so D made that the
default.
On Monday, 24 July 2017 at 15:41:33 UTC, Steven Schveighoffer
wrote:
Because types with inheritance generally don't work right if
you pass by value (i.e. the slicing problem).
structs don't support inheritance or virtual functions, so they
can be safely passed by value.
But in C++, we
On Monday, 24 July 2017 at 15:37:51 UTC, Andrea Fontana wrote:
Maybe this will help you:
https://stackoverflow.com/questions/10965577/usage-preference-between-a-struct-and-a-class-in-d-language
Thanks for this informative link.
On 7/24/17 11:21 AM, Houdini wrote:
Hello,
I am a C++ coder, and I am learning D (just reading a book, for now).
D is very similar to C++ (and also grabs godd ideas from Python), but I
have a naive question : why does Walter Bright chose to instanciate
classes like in Java ? And why is it
On Monday, 24 July 2017 at 15:21:54 UTC, Houdini wrote:
Hello,
I am a C++ coder, and I am learning D (just reading a book, for
now).
D is very similar to C++ (and also grabs godd ideas from
Python), but I have a naive question : why does Walter Bright
chose to instanciate classes like in
Hello,
I am a C++ coder, and I am learning D (just reading a book, for
now).
D is very similar to C++ (and also grabs godd ideas from Python),
but I have a naive question : why does Walter Bright chose to
instanciate classes like in Java ? And why is it different for
structs ?
rikki cattermole wrote:
Tell it to free[0] the array directly.
```D
T[] array;
GC.free(array.ptr);
or just `delete arr;`. it is marked as "deprecated" in changelog, but who
cares? it works.
Stuff the GC.
You don't need it to care about collecting (or destroying for that matter).
Tell it to free[0] the array directly.
```D
T[] array;
GC.free(array.ptr);
```
Normally I would suggest to create your own buffer, but because of the
DB library probably doesn't support that, no point
Hi guys, I have a question on how to free large arrays in D after
they're no longer needed.
Let's say I have this:
SomeKey[] getKeys() {
SomeKey[] n;
foreach(batching stuff...) {
SomeKey newstuff = db.select!(SomeKey[])(...); // gets around
6M of these from db
On Monday, 24 July 2017 at 07:08:56 UTC, Basile B. wrote:
On Friday, 21 July 2017 at 14:21:37 UTC, Timoses wrote:
I'd love to check whether a string value is the name of a type
at run-time.
[...]
The goal is to identify whether a string represents a custom
type within a package. I'm also
On Saturday, 22 July 2017 at 20:55:06 UTC, kerdemdemir wrote:
And what if I want to go diagonal like 1,5,9 or 3,5,7 in the
example above. Is there a good solution in std without using
for loops?
I suggest using an actual matrix type for tasks like this. I
don't know about diagonal slicing,
It is worth noting too that mach's map function will not behave
this way; UTF encoding and decoding is instructed explicitly and
is not done implicitly like in phobos.
https://github.com/pineapplemachine/mach.d
import mach.range : map, asarray;
import mach.text.ascii : toupper;
On Monday, 24 July 2017 at 09:05:43 UTC, Johan wrote:
Hi all,
What am I doing wrong here?
```
import std.algorithm;
int foo(char c) {
return 123;
}
auto mapFoo(char[] chars) {
return chars.map!(a => a.foo);
}
```
errors with:
main.d(14): Error: function main.foo (char c) is not
Hi all,
What am I doing wrong here?
```
import std.algorithm;
int foo(char c) {
return 123;
}
auto mapFoo(char[] chars) {
return chars.map!(a => a.foo);
}
```
errors with:
main.d(14): Error: function main.foo (char c) is not callable
using argument types (dchar)
On Friday, 21 July 2017 at 14:21:37 UTC, Timoses wrote:
I'd love to check whether a string value is the name of a type
at run-time.
[...]
The goal is to identify whether a string represents a custom
type within a package. I'm also trying to iterate over all
modules within the package to get
On Friday, 21 July 2017 at 14:44:23 UTC, Steven Schveighoffer
wrote:
On 7/21/17 10:21 AM, Timoses wrote:
I'd love to check whether a string value is the name of a type
at run-time.
E.g.:
string a = "int";
string b = "im no type";
assert( isStringType(a) );
assert( !isStringType(b) );
or
49 matches
Mail list logo