Dne 21.2.2017 v 08:31 Johan Engelen via Digitalmars-d-learn napsal(a):
On Monday, 20 February 2017 at 13:16:15 UTC, Jonathan M Davis wrote:
dmd is great for fast compilation and therefore it's great for
development. However, while it produces decent binaries, and it may
very well do certain
Dne 19.2.2017 v 20:19 berni via Digitalmars-d-learn napsal(a):
Is it possible to force a function to be inlined?
Comparing a C++ and a D program, the main difference in speed (about
20-30%) is, because I manage to force g++ to inline a function while I
do not find any means to do the same on
Dne 19.2.2017 v 20:19 berni via Digitalmars-d-learn napsal(a):
Is it possible to force a function to be inlined?
Comparing a C++ and a D program, the main difference in speed (about
20-30%) is, because I manage to force g++ to inline a function while I
do not find any means to do the same on
Dne 18.2.2017 v 21:15 timmyjose via Digitalmars-d-learn napsal(a):
Hello folks,
I am interested in learning D (just starting out, did a few of the
exercises on the D tour), and had some questions before I decide to
jump right in. My questions are genuinely motivated by my experiences
and
Dne 14.2.2017 v 07:48 TheGag96 via Digitalmars-d-learn napsal(a):
https://dpaste.dzfl.pl/adc05892344f (btw, any reason why certificate
validation on dpaste fails right now?)
Because certificate is expired, dpaste use certs from Lets Encrypt which
has short time of validity
I have same issue
Dne 13.2.2017 v 17:40 Daniel Kozak napsal(a):
Dne 13.2.2017 v 16:28 Bastiaan Veelo via Digitalmars-d-learn napsal(a):
Hi,
In Extended Pascal, you can derive from a basic type and change the
default initialiser like so:
type int1 = integer value 1;
var i : int1;
ii : int1 value
Dne 13.2.2017 v 16:28 Bastiaan Veelo via Digitalmars-d-learn napsal(a):
Hi,
In Extended Pascal, you can derive from a basic type and change the
default initialiser like so:
type int1 = integer value 1;
var i : int1;
ii : int1 value 2;
assert(i = 1);
assert(ii = 2);
I have it
Dne 10.2.2017 v 10:03 berni via Digitalmars-d-learn napsal(a):
On Tuesday, 7 February 2017 at 19:06:22 UTC, berni wrote:
auto arr = uninitializedArray!(int[][])(ROWS,COLS);
arr.each!"a[]=-1";
This looks like what I was looking for. At least I think I understand
what's going on here. The
Dne 9.2.2017 v 23:08 Ali Çehreli via Digitalmars-d-learn napsal(a):
On 02/09/2017 02:04 PM, Nestor wrote:
> I tried running each algoritm a few times through avgtime using
> different digit lengths
avgtime profiles the whole process, right? It measures everything that
is involved in that
Dne 9.2.2017 v 22:29 Nestor via Digitalmars-d-learn napsal(a):
On Thursday, 9 February 2017 at 20:46:06 UTC, Daniel Kozak wrote:
Maybe you can try use static array instead of dynamic
static immutable ubyte[10][10] QG10Matrix = ...
I shaved it to this to discard unneccessary time-consuming
Dne 9.2.2017 v 21:10 berni via Digitalmars-d-learn napsal(a):
On Thursday, 9 February 2017 at 19:10:55 UTC, Daniel Kozak wrote:
Dne 9.2.2017 v 17:20 berni via Digitalmars-d-learn napsal(a):
[...]
Ah ok, I understand. So calling with "dmd Special/special.d
Common/common.d" works.
But
Dne 9.2.2017 v 20:39 Nestor via Digitalmars-d-learn napsal(a):
On Thursday, 9 February 2017 at 18:34:30 UTC, Era Scarecrow wrote:
On Thursday, 9 February 2017 at 17:36:11 UTC, Nestor wrote:
I was trying to port C code from the article in Wikiversity [1] to
D, but I'm not sure this
Dne 9.2.2017 v 17:20 berni via Digitalmars-d-learn napsal(a):
dmd only compiles in the files you actually pass to it. rdmd will try
to find the required files automatically.
Since you didn't pass the file with the function to dmd, it knows it
exists, but leaves it out of the final link (it
On Thursday, 9 February 2017 at 12:13:36 UTC, Daniel Kozák wrote:
V Thu, 09 Feb 2017 11:22:28 +
Suliman via Digitalmars-d-learn
napsáno:
Docs says that:
"The total size of a static array cannot exceed 16Mb."
But when I am creation array of:
int
One another way is use something like this:
import std.array, std.algorithm, std.stdio;
auto arr = uninitializedArray!(int[][])(ROWS,COLS);
arr.each!"a[]=-1";
writeln(arr);
Dne 6. 2. 2017 8:21 PM napsal uživatel "berni via Digitalmars-d-learn" <
digitalmars-d-learn@puremagic.com>:
> On Sunday, 5
http://stackoverflow.com/questions/24600796/d-set-default-value-for-a-struct-member-which-is-a-multidimensional-static-arr/24754361#24754361
Dne 5.2.2017 v 21:33 berni via Digitalmars-d-learn napsal(a):
With X not known at compile time:
auto arr = new int[][](X,X);
for (int i=0;i
Dne 2.2.2017 v 21:43 John Doe via Digitalmars-d-learn napsal(a):
On Thursday, 2 February 2017 at 20:26:36 UTC, Daniel Kozak wrote:
Dne 2. 2. 2017 20:35 napsal uživatel "John Doe via
Digitalmars-d-learn" < digitalmars-d-learn@puremagic.com>:
On Thursday, 2 February 2017 at 18:58:46 UTC,
Dne 2. 2. 2017 20:35 napsal uživatel "John Doe via Digitalmars-d-learn" <
digitalmars-d-learn@puremagic.com>:
On Thursday, 2 February 2017 at 18:58:46 UTC, Daniel Kozak wrote:
> Even this one could works:
>
> import std.stdio;
>
> void main(string[] args)
> {
> auto range =
More range aproach, untested written on the fly from mobile phone
import std.stdio : File;
import std.range : chunks;
import.std.algorithm : map, filter, array;
void main()
{
auto r = File("text.txt").byLine
.filter!(a=>a.length)
.chunks(2)
.map!(a=>[a[0].dup, a[1].dup])
Even this one could works:
import std.stdio;
void main(string[] args)
{
auto range = File("text.txt").byLine();
foreach (line; range)
{
if (line != "")
{
writeln(line);
range.popFront;
char[] url = range.front().dup;
Dne 2. 2. 2017 7:24 PM napsal uživatel "Daniel Kozak" :
There is a readln function, and this is not forum but just web frontend
around mailing list. http://forum.dlang.org/help#about
https://dlang.org/phobos/std_stdio.html#.File.readln
There is a readln function, and this is not forum but just web frontend
around mailing list. http://forum.dlang.org/help#about
Dne 2. 2. 2017 7:20 PM napsal uživatel "John Doe via Digitalmars-d-learn" <
digitalmars-d-learn@puremagic.com>:
> Let's say you're trying to parse a file format like:
>
On Saturday, 3 December 2016 at 16:07:47 UTC, moe wrote:
On Sunday, 11 September 2016 at 02:17:21 UTC, Vlasov Roman
wrote:
Hello, guys.
I tried to build HelloWorld with dub, but i got strange linker
error:
[...]
I just switched from Windows to linux (arch) and got the exact
same problem.
Dne 22.11.2016 v 14:29 RazvanN via Digitalmars-d-learn napsal(a):
Given the following code:
char[5] a = ['a', 'b', 'c', 'd', 'e'];
alias Range = char[];
writeln(is(ElementType!Range == char));
One would expect that the program will print true. In fact, it prints
false and I noticed that
Dne 22.11.2016 v 14:29 RazvanN via Digitalmars-d-learn napsal(a):
Given the following code:
char[5] a = ['a', 'b', 'c', 'd', 'e'];
alias Range = char[];
writeln(is(ElementType!Range == char));
One would expect that the program will print true. In fact, it prints
false and I noticed that
Dne 21.11.2016 v 13:44 Jonathan M Davis via Digitalmars-d-learn napsal(a):
... it's easy enough to just create a
template to do the same thing, it's not worth adding to the language.
That's a problem. I belive there is a lot of things which are easy to
add by some kind of magic (template or
Dne 16.11.2016 v 23:43 lafoldes via Digitalmars-d-learn napsal(a):
Hi,
I'd like to create a UTF16 text file on Windows 7, using
std.stdio.File and std.stdio.File.write... functions (so no binary
write, no Win32 functions).
I was experimenting with variations of this code…:
import std.stdio;
Dne 10.11.2016 v 17:41 Charles Hixson via Digitalmars-d-learn napsal(a):
The line:
assert(isnan (c.curActivation), "cell has unexpected
curActivation: %s".format(c.curActivation));
throws the exception:
core.exception.AssertError@cell.d(285): cell has unexpected
curActivation: nan
Dne 8.11.2016 v 21:16 Bryce Kellogg via Digitalmars-d-learn napsal(a):
...
Finally, a one line package.d:
public import my_package.my_module;
Change it to:
module my_package;
public import my_package.my_module;
Btw, having class name same as module name is not best way, there could
be
Dne 31.10.2016 v 20:20 Charles Hixson via Digitalmars-d-learn napsal(a):
...
but
dmd -defaultlib=libphobos2.so -fPIC test.d
works. It shouldn't be required (as in the default /etc/dmd.conf
should handle it correctly, but I can deal with it now.
It should work, it is possible that you have
Dne 31.10.2016 v 18:06 Charles Hixson via Digitalmars-d-learn napsal(a):
On 10/31/2016 09:26 AM, Charles Hixson via Digitalmars-d-learn wrote:
On 10/30/2016 11:34 PM, Daniel Kozak via Digitalmars-d-learn wrote:
Dne 31.10.2016 v 02:30 Charles Hixson via Digitalmars-d-learn
napsal(a):
Well
Dne 31.10.2016 v 02:30 Charles Hixson via Digitalmars-d-learn napsal(a):
Well, that certainly changed the error messages. With
dmd -defaultlib=/usr/lib/x86_64-linux-gnu/libphobos2.so test.d
I get:
/usr/include/dmd/druntime/import/core/stdc/stdio.d(1121): Error: found
'nothrow' when expecting
Dne 27.10.2016 v 20:54 Jot via Digitalmars-d-learn napsal(a):
Using Vibe.D here;
How can one work with the DB's abstractly without incurring duplicity.
I'd like to be able to create one struct and use that, either in D or
the DB. I'd prefer to create a struct in D and interact through that
Dne 22.10.2016 v 11:04 Mike Parker via Digitalmars-d-learn napsal(a):
On Saturday, 22 October 2016 at 08:05:12 UTC, Daniel Kozak wrote:
uint[string] dictionary;
should be
uint[size_t] dictionary;
because size_t is 32bit on x86 system and 64bit on x86_64
and you are trying to put array length
Dne 22.10.2016 v 07:41 Mark via Digitalmars-d-learn napsal(a):
Thanks for the fast reply.
That did work. But now the error is on the line:
dictionary[word] = newId;
I changed the value to 10, still errors. ??
everything else is as before.
thanks.
uint[string] dictionary;
should
Dne 21.10.2016 v 21:03 DLearner via Digitalmars-d-learn napsal(a):
On Friday, 21 October 2016 at 09:07:35 UTC, cym13 wrote:
On Friday, 21 October 2016 at 08:58:50 UTC, DLearner wrote:
[...]
What makes you think that? It's hard to tell if you don't give any
information.
I pressed the
Dne 17.10.2016 v 23:40 Christian Köstlin via Digitalmars-d-learn napsal(a):
Could someone check the numbers on another OS-X machine? Unfortunately I
only have one available.
Thanks in advance!
Can you try it on OSX with ldc compiler:
dub run --build=release --compiler=ldc
Dne 16.10.2016 v 10:41 Christian Köstlin via Digitalmars-d-learn napsal(a):
Hi,
for an exercise I had to implement a thread safe counter.
This is what I came up with:
btw. I run the code with dub run --build=release
Thanks in advance,
Christian
So I have done some testing, on my pc:
Dne 17.10.2016 v 11:56 markov via Digitalmars-d-learn napsal(a):
Thanks.
So something like this would be helpful in core.thread?
void startThread(alias fun, P...)(P p){
new Thread({fun(p);}).start();
}
or without delegate
import std.stdio;
import core.thread;
void fun(alias a, alias
On Monday, 17 October 2016 at 06:38:08 UTC, Daniel Kozak wrote:
Dne 17.10.2016 v 07:55 Christian Köstlin via
Digitalmars-d-learn napsal(a):
[...]
I am still unable to get your java code working:
[kozak@dajinka threads]$ ./gradlew clean build
:clean
:compileJava
:processResources UP-TO-DATE
Dne 17.10.2016 v 07:55 Christian Köstlin via Digitalmars-d-learn napsal(a):
to run java call ./gradlew clean build
->
counter.AtomicIntCounter@25992ae3 expected: 200 got: 100 in: 22ms
counter.AtomicLongCounter@2539f946 expected: 200 got: 100 in: 17ms
Dne 16.10.2016 v 10:41 Christian Köstlin via Digitalmars-d-learn napsal(a):
My question now is, why is each mutex based thread safe variant so slow
compared to a similar java program? The only hint could be something
like:
Dne 14.10.2016 v 00:06 Nordlöw via Digitalmars-d-learn napsal(a):
On Thursday, 13 October 2016 at 19:28:11 UTC, Daniel Kozak wrote:
You can easy try it. Just build dmd with dmd, than with ldc. And then
try to compile DMD frontend with both dmd versions :)
Dne 13.10.2016 v 21:07 Nordlöw via
You can easy try it. Just build dmd with dmd, than with ldc. And then
try to compile DMD frontend with both dmd versions :)
Dne 13.10.2016 v 21:07 Nordlöw via Digitalmars-d-learn napsal(a):
Is there a large speed difference in compilation time depending on
whether the DMD used is built using
Dne 10.10.2016 v 03:43 Konstantin Kutsevalov via Digitalmars-d-learn
napsal(a):
On Monday, 26 September 2016 at 23:40:10 UTC, Vincent wrote:
Hello, guys!
I was very surprised that module 'socketstream' was deprecated.
Usually if something become obsolete, there is some perfect
replacement!
That makes sense :). Thanks
Dne 5.10.2016 v 10:27 Mike Parker via Digitalmars-d-learn napsal(a):
On Wednesday, 5 October 2016 at 08:23:25 UTC, Mike Parker wrote:
The ~> constrains the dependency to the minor version number, meaning
DUB will not try to use a version of the dependency that
I really does not understand how does DUB works. I have small app
which use vibe-d:core as dependency, and I use libasync as
subConfiguration. When I try to build my app it always try to
download libasync-0.7.9 instead of libasync-0.8.0. Why? I would
expect to select the latest one frum dub
Dne 15.9.2016 v 15:57 rikki cattermole via Digitalmars-d-learn napsal(a):
On 16/09/2016 1:54 AM, deed wrote:
void main ()
{
new int[](1);
}
Compiles with dmd 2.071.2-b2, but no code is generated for `new
int[](1);`.
Caused a bug due to:
char[] arr;
got updated to
char[] arr; new
And are you sure it is using tcp4 socket on port 3306? You can use
netstat -tlnp to see if is running on tcpv4 3306
Dne 12.9.2016 v 15:25 Geert via Digitalmars-d-learn napsal(a):
On Monday, 12 September 2016 at 09:59:30 UTC, wobbles wrote:
On Monday, 12 September 2016 at 05:31:46 UTC, Geert
On Monday, 5 September 2016 at 17:38:10 UTC, Daniel Kozak wrote:
On Monday, 5 September 2016 at 15:53:39 UTC, dom wrote:
is this code safe? if not how do i do it correctly?
static AsyncHttpGet[] openRequests;
static void updateRequests()
{
foreach(idx,
On Monday, 5 September 2016 at 15:53:39 UTC, dom wrote:
is this code safe? if not how do i do it correctly?
static AsyncHttpGet[] openRequests;
static void updateRequests()
{
foreach(idx, req; openRequests)
{
Dne 5.9.2016 v 14:30 Daniel Kozak napsal(a):
Dne 5.9.2016 v 14:15 dom via Digitalmars-d-learn napsal(a):
...
but what is the difference between a lambda (=>) and a
functions/delegates?
i think this is a major pitfall for newcomers, and should be adressed
somehow.
Yes, RTFM :)
But to be
Dne 5.9.2016 v 14:15 dom via Digitalmars-d-learn napsal(a):
...
but what is the difference between a lambda (=>) and a
functions/delegates?
i think this is a major pitfall for newcomers, and should be adressed
somehow.
Yes, RTFM :)
Dne 5.9.2016 v 14:15 dom via Digitalmars-d-learn napsal(a):
I am about to write my own stupid and simple http client .. and i have
added a callback function that has the received content as a parameter.
class AsyncHttpGet
{
this(string host, ushort port, string path, void delegate(string)
Dne 5.9.2016 v 13:45 Patric via Digitalmars-d-learn napsal(a):
On Monday, 5 September 2016 at 11:20:08 UTC, rikki cattermole wrote:
On 05/09/2016 11:11 PM, Patric wrote:
I´m playing remaking D functionalities with nogc structs, and to at
least match D performance.
But in this particular case
Dne 5.9.2016 v 13:17 Daniel Kozak napsal(a):
Dne 5.9.2016 v 13:11 Patric via Digitalmars-d-learn napsal(a):
I´m playing remaking D functionalities with nogc structs, and to at
least match D performance.
But in this particular case i´m unable to get near D performance.
Can someone point me
Dne 5.9.2016 v 13:11 Patric via Digitalmars-d-learn napsal(a):
I´m playing remaking D functionalities with nogc structs, and to at
least match D performance.
But in this particular case i´m unable to get near D performance. Can
someone point me out what i´m doing wrong, or if there is some
Dne 29.8.2016 v 16:43 Steinhagelvoll via Digitalmars-d-learn napsal(a):
On Monday, 29 August 2016 at 13:59:15 UTC, Daniel Kozak wrote:
Dne 29.8.2016 v 11:53 Steinhagelvoll via Digitalmars-d-learn napsal(a):
[...]
It is unfair to compare different backend:
gfortran -O3 -o test test.f90
Dne 29.8.2016 v 16:21 Stefan Koch via Digitalmars-d-learn napsal(a):
On Monday, 29 August 2016 at 09:53:12 UTC, Steinhagelvoll wrote:
Hello,
I'm trying to find a fast way to use multi dimensional arrays. For
this I implemented a matrix multiplication and compared the times for
different
Dne 29.8.2016 v 16:08 rikki cattermole via Digitalmars-d-learn napsal(a):
Okay looks like I've made a boo boo and ldc is compiling out that
entire multiplication loop out.
Its passing the array statically and since its never assigned back,
its just never compiled in (unless you specify it
Dne 29.8.2016 v 15:57 rikki cattermole via Digitalmars-d-learn napsal(a):
My bad, fixed:
double[1000][] A, B, C;
void main() {
A = new double[1000][1000];
B = new double[1000][1000];
C = new double[1000][1000];
import std.conv : to;
import
Dne 29.8.2016 v 11:53 Steinhagelvoll via Digitalmars-d-learn napsal(a):
Hello,
I'm trying to find a fast way to use multi dimensional arrays. For
this I implemented a matrix multiplication and compared the times for
different ways. As a reference I used a Fortran90 implementation.
Fortran
Dne 29.8.2016 v 14:13 Steinhagelvoll via Digitalmars-d-learn napsal(a):
Ok I added release and implemented the benchmark for 500 iterations,
1 are not reasonable. I build on the 2d array with LDC:
http://pastebin.com/aXxzEdS4 (changes just in the beginning)
$ ldc2 -release -O3 nd_test.d
Dne 27.8.2016 v 02:04 pineapple via Digitalmars-d-learn napsal(a):
I would just love if I could express this as something more like
context(auto file = File("some_file.txt")){
file.write();
}
void main(string[] args)
{
with(File("some_file.txt"))
{
write();
On Friday, 26 August 2016 at 06:56:06 UTC, Alex wrote:
Hi everybody,
I'm little at loss: as documented, a JSONValue is only shallow
copied:
...
So the effect that the code of "j" is altered was expected.
The question is: how to make a deep copy of a JSONValue? Is
there a simple way without
Dne 26.8.2016 v 09:12 magicdmer via Digitalmars-d-learn napsal(a):
On Friday, 26 August 2016 at 07:00:37 UTC, rikki cattermole wrote:
Okay so your Windows language is non-english, that'll be it.
You need to be looking into the encoding that Visual Studio is using
for you files. Something to
Dne 26.8.2016 v 08:56 Alex via Digitalmars-d-learn napsal(a):
void main()
{
import std.json;
import std.stdio;
string s = "{ \"language\": \"D\", \"rating\": 3.14, \"code\": 42 }";
JSONValue j = parseJSON(s);
writeln("code: ", j["code"].integer);
auto j2 = j;
Dne 26.8.2016 v 08:52 magicdmer via Digitalmars-d-learn napsal(a):
On Friday, 26 August 2016 at 06:38:01 UTC, Daniel Kozak wrote:
That image is too small, so I can't see it :)
Dne 26.8.2016 v 08:26 magicdmer via Digitalmars-d-learn napsal(a):
I use VisualD create a windows dll project , and
That image is too small, so I can't see it :)
Dne 26.8.2016 v 08:26 magicdmer via Digitalmars-d-learn napsal(a):
I use VisualD create a windows dll project , and select the "Use
MS-COFF object file fromat for win32" . when i build it ,it display
the error follow ,look at the picture
I use
Btw, tehre is no need for extra semicolon (`;`) after enum and struct
definition
Dne 25.8.2016 v 12:23 Cauterite via Digitalmars-d-learn napsal(a):
On Wednesday, 24 August 2016 at 23:04:25 UTC, Illuminati wrote:
Well those other answers aren't wrong, but I envisioned that you'd
have
And if you need more levels:
struct MyEnum {
static struct AnotherEnum {
enum X { Y = 10, Z = 20 }
}
}
void main() {
import std.stdio;
int y = MyEnum.AnotherEnum.X.Y;
writeln(y);
}
Dne 25.8.2016 v 03:37 Mike Parker via Digitalmars-d-learn napsal(a):
On
I am not sure but on Arch linux I always recompile dub myself because by
default it is build without release flags too.
Dne 2.6.2016 v 15:07 ciechowoj via Digitalmars-d-learn napsal(a):
Maybe it would be worth to write something about the issue here
https://github.com/dlang/dub#installation .
Why not to use distribute oprion?
Dne 27. 5. 2016 17:35 napsal uživatel "yawniek via Digitalmars-d-learn" <
digitalmars-d-learn@puremagic.com>:
> On Friday, 27 May 2016 at 13:45:23 UTC, llaine wrote:
>
>> Hi guys,
>>
>> In my journey of learning about D I tried to benchmark D with Vibe.d vs
>>
On Friday, 27 May 2016 at 14:18:31 UTC, llaine wrote:
On Friday, 27 May 2016 at 14:17:16 UTC, Adam D. Ruppe wrote:
On Friday, 27 May 2016 at 13:45:23 UTC, llaine wrote:
I am doing something wrong ?
So, the benchmark, the Ruby, and the JS all use the path to be
/ the D seems to use
Dne 24.5.2016 v 17:27 llaine via Digitalmars-d-learn napsal(a):
Hi everybody,
As written in the description I'm really new to D, I discovered it a
few weeks ago thanks to the D Conf in Berlin.
After playing around for couple of days with it, I wanted to share my
journey with you guys on
Dne středa 11. května 2016 16:32:18 CEST, Chris via Digitalmars-d-learn
napsal(a):
On Wednesday, 11 May 2016 at 14:28:00 UTC, Vladimir Panteleev wrote:
On Wednesday, 11 May 2016 at 14:26:37 UTC, Vladimir Panteleev wrote: ...
Hm. What's the point then of using
import std.string : strip;
Dne středa 11. května 2016 13:25:50 CEST, VlasovRoman via
Digitalmars-d-learn napsal(a):
Hey, guys!
After many attempts pmap function was realized by me. This is
analogous to taskPool.amap function, but I do not know how much
he is good. In simple tests, it showed a corresponding
Dne 8.4.2016 v 14:56 Steven Schveighoffer via Digitalmars-d-learn napsal(a):
On 4/8/16 2:08 AM, 9il wrote:
On Thursday, 7 April 2016 at 15:55:16 UTC, Steven Schveighoffer wrote:
On 4/6/16 11:10 AM, Andre wrote:
[...]
Just FYI, you don't need a semicolon there.
[...]
Wow, totally agree
On Friday, 8 April 2016 at 06:08:38 UTC, 9il wrote:
On Thursday, 7 April 2016 at 15:55:16 UTC, Steven Schveighoffer
wrote:
On 4/6/16 11:10 AM, Andre wrote:
[...]
Just FYI, you don't need a semicolon there.
[...]
Wow, totally agree with you. Compiler shouldn't make you jump
through this
This should not compile. Cat cant access create because it is private. Ok
it can access it but only if you move cat into same module as animal
Dne 6. 4. 2016 17:16 napsal uživatel "Andre via Digitalmars-d-learn" <
digitalmars-d-learn@puremagic.com>:
> Hi,
>
> With 2.071 following coding does not
Dne 9.3.2016 v 11:26 Guillaume Piolat via Digitalmars-d-learn napsal(a):
On Wednesday, 9 March 2016 at 10:08:33 UTC, ag0aep6g wrote:
On 09.03.2016 10:56, Guillaume Piolat wrote:
If I understand purity correctly
(http://klickverbot.at/blog/2012/05/purity-in-d/), every function out
there can
I would say dub is broken and should be fixed. Even dub run is really
slow and try to build everything. So please report a bug:
https://github.com/D-Programming-Language/dub/issues
Dne 7.3.2016 v 19:58 ciechowoj via Digitalmars-d-learn napsal(a):
dub --version
DUB version 0.9.24+161-gb9ce700,
maybe: dub build --nodeps
Dne 7.3.2016 v 10:18 ciechowoj via Digitalmars-d-learn napsal(a):
I'm using `dub` to build project. And every time I run `dub` it seems
to check if dependencies are up to date, which takes some time. Is
there a way to switch of that checking? Or any other way to speed
Dne 3.3.2016 v 09:58 Shriramana Sharma via Digitalmars-d-learn napsal(a):
Hello people and thanks for your replies.
Jonathan M Davis via Digitalmars-d-learn wrote:
You can't overload a function and an eponymous template like that. They
need to have distinct names.
Why is it not possible
Dne 3.3.2016 v 07:12 Shriramana Sharma via Digitalmars-d-learn napsal(a):
Hello. I have a function I want to make CTFE-able as a template.
string ta(string s) { return s ~ "1"; }
template ta(string s) { enum ta = ta(s); }
void main() { string s = ta!"s"; }
Compiling the above I get the
Dne 2.3.2016 v 21:39 Adam D. Ruppe via Digitalmars-d-learn napsal(a):
On Wednesday, 2 March 2016 at 12:27:04 UTC, Adrian Matoga wrote:
Is it by design or is it a bug?
And, if it is by design, what is the reason for that?
That's by design. It allows you to override names from a template
On Wednesday, 2 March 2016 at 14:50:15 UTC, Adrian Matoga wrote:
On Wednesday, 2 March 2016 at 14:36:59 UTC, Daniel Kozak wrote:
OK maybe this one:
template AddField(T) {
T b;
this(Args...)(T b, auto ref Args args)
{
this.b = b;
this(args);
}
this(int a) {
On Wednesday, 2 March 2016 at 13:18:23 UTC, Adrian Matoga wrote:
On Wednesday, 2 March 2016 at 12:48:47 UTC, Daniel Kozak wrote:
On Wednesday, 2 March 2016 at 12:27:04 UTC, Adrian Matoga
wrote:
(...)
You can use string mixins:
template AddField(T) {
enum AddField = T.stringof ~ `
On Wednesday, 2 March 2016 at 12:27:04 UTC, Adrian Matoga wrote:
I can do this:
struct Foo {
int a;
string b;
this(int a) { this.a = a; }
this(Args...)(string b, auto ref Args args) { this.b = b;
this(args); }
}
unittest {
auto foo1 = Foo(5);
auto
On Wednesday, 2 March 2016 at 12:27:04 UTC, Adrian Matoga wrote:
I can do this:
struct Foo {
int a;
string b;
this(int a) { this.a = a; }
this(Args...)(string b, auto ref Args args) { this.b = b;
this(args); }
}
unittest {
auto foo1 = Foo(5);
auto
On Tuesday, 1 March 2016 at 19:59:19 UTC, Ali Çehreli wrote:
On 03/01/2016 08:50 AM, karabuta wrote:
I am almost done with the "programming in D" book. Where will
you
suggest a go from there.
Like others said, I would spend time on Phobos to become
familiar with it; there are many gems in
auto square_root(T)(T x) if (isBasicType!T)
in
{
assert(x >= 0);
}
out (result)
{
assert((result * result) <= x && (result+1) * (result+1) > x);
}
body
{
return cast(long)std.math.sqrt(cast(real)x);
}
void main()
{
import std.stdio: writeln;
writeln(square_root(2));
}
Dne
Dne 29.2.2016 v 15:38 Ozan via Digitalmars-d-learn napsal(a):
T square_root(T)(T x) if (isBasicType!T) {
in
{
assert(x >= 0);
}
out (result)
{
assert((result * result) <= x && (result+1) * (result+1) > x);
}
body
{
return cast(long)std.math.sqrt(cast(real)x);
}
import
In your case I would guess with -O -release -inline it would generate
assambly with same (similar) speed.
But in this case it would be different:
mixin template Test()
{
int returnInit() { return int.init; }
}
int returnInitImpl() { return int.init; }
class A
{
mixin Test!(); //
So I guess pairwise summation is one to blame here.
Dne 21.2.2016 v 16:56 Daniel Kozak napsal(a):
You can use -profile to see what is causing it.
Num TreeFuncPer
CallsTimeTimeCall
2300 550799875 550243765 23 pure
You can use -profile to see what is causing it.
Num TreeFuncPer
CallsTimeTimeCall
2300 550799875 550243765 23 pure nothrow @nogc
@safe double std.algorithm.iteration.sumPairwise!(double,
V Tue, 09 Feb 2016 12:46:59 +
Whirlpool via Digitalmars-d-learn
napsáno:
> Hello,
>
> When you are using a C function (from an external library) that
> returns a pointer on char which is the beginning of a string (I
> know that C does not have a string
OK it seems wierd
On Tue, Feb 9, 2016 at 4:52 PM, Daniel Kozak wrote:
> It is OK, I guess the output is just mixed
>
> On Tue, Feb 9, 2016 at 4:35 PM, miazo via Digitalmars-d-learn <
> digitalmars-d-learn@puremagic.com> wrote:
>
>> Hi,
>>
>> The following simple program:
>>
: ", cast(void *)tT.mbox);
> }
>
>
> On Tue, Feb 9, 2016 at 4:55 PM, Ali Çehreli
> <digitalmars-d-learn@puremagic.com> wrote:
>>
>> On 02/09/2016 07:52 AM, Daniel Kozak via Digitalmars-d-learn wrote:
>>>
>>> It is OK, I guess the output is just m
It is OK, I guess the output is just mixed
On Tue, Feb 9, 2016 at 4:35 PM, miazo via Digitalmars-d-learn <
digitalmars-d-learn@puremagic.com> wrote:
> Hi,
>
> The following simple program:
>
> import std.stdio, std.concurrency;
>
> void f1() {
> writeln("owner: ", ownerTid);
>
201 - 300 of 451 matches
Mail list logo