On Monday, 2 May 2016 at 23:41:39 UTC, Steven Schveighoffer wrote:
On 5/2/16 6:00 PM, sigod wrote:
On Monday, 2 May 2016 at 10:15:04 UTC, Marc Schütz wrote:
On Monday, 2 May 2016 at 08:46:31 UTC, Ali Çehreli wrote:
[...]
Warning (better: disallowing altogether) about `=>` directly
followed
On Wednesday, 4 May 2016 at 04:56:54 UTC, Joel wrote:
On Sunday, 1 May 2016 at 05:42:00 UTC, Ali Çehreli wrote:
[...]
This seems to work the best:
arr.each!(a => { writeln(a); }());
And the ugliest. And probably slowest.
On Monday, 2 May 2016 at 10:15:04 UTC, Marc Schütz wrote:
On Monday, 2 May 2016 at 08:46:31 UTC, Ali Çehreli wrote:
[...]
Warning (better: disallowing altogether) about `=>` directly
followed by `{` should be enough to cover all cases. To express
that you really want a lambda returning a
On Thursday, 28 April 2016 at 14:08:26 UTC, Steven Schveighoffer
wrote:
On 4/28/16 8:56 AM, Jay Norwood wrote:
[...]
.reserve should make an improvement for large amount of
appending, since you pre-allocate the data.
[...]
How about `assumeSafeAppend`? Does it have any positive impact on
On Friday, 11 March 2016 at 18:45:13 UTC, Anonymouse wrote:
On Friday, 11 March 2016 at 17:33:43 UTC, sigod wrote:
On Friday, 11 March 2016 at 17:03:38 UTC, Anonymouse wrote:
On Friday, 11 March 2016 at 15:21:38 UTC, maik klein wrote:
[...]
As a drive-by comment, mind that
On Friday, 11 March 2016 at 17:03:38 UTC, Anonymouse wrote:
On Friday, 11 March 2016 at 15:21:38 UTC, maik klein wrote:
static Singleton!T get()
{
if (!instantiated_)
{
synchronized(Singleton!T.classinfo){
if (!instance_){
On Wednesday, 2 March 2016 at 02:36:50 UTC, Charles wrote:
Watched a video on Jonathan Blow's language that he's
developing, and he has a pretty neat idea of having tools being
part of the language. Looking at the first 15
minutes(https://www.youtube.com/watch?v=OHZwYYW9koI) or so of
the
On Saturday, 27 February 2016 at 23:43:07 UTC, cym13 wrote:
Could you please provide a link to said comment? Maybe some
context would help bring some sanity over this statement.
Topic:
https://www.reddit.com/r/programming/comments/30sqtd/why_didnt_the_d_language_become_mainstream_as/
Said
On Thursday, 25 February 2016 at 12:18:07 UTC, mahdi wrote:
On Thursday, 25 February 2016 at 11:50:02 UTC, sigod wrote:
On Thursday, 25 February 2016 at 10:03:08 UTC, mahdi wrote:
Thanks.
So when we define the function, we MUST specify the array
size to be able to accept a static array?
On Thursday, 25 February 2016 at 12:18:07 UTC, mahdi wrote:
On Thursday, 25 February 2016 at 11:50:02 UTC, sigod wrote:
On Thursday, 25 February 2016 at 10:03:08 UTC, mahdi wrote:
Thanks.
So when we define the function, we MUST specify the array
size to be able to accept a static array?
On Thursday, 25 February 2016 at 10:03:08 UTC, mahdi wrote:
Thanks.
So when we define the function, we MUST specify the array size
to be able to accept a static array?
Can't we just define a function which can accept any static
array with any size? (e.g. a function to calculate average of a
On Sunday, 21 February 2016 at 16:20:30 UTC, bachmeier wrote:
On Sunday, 21 February 2016 at 14:32:15 UTC, dextorious wrote:
I had heard while reading up on the language that in D
explicit loops are generally frowned upon and not necessary
for the usual performance reasons.
First, a minor
On Tuesday, 16 February 2016 at 18:30:43 UTC, Nick wrote:
Hey folks
I'm making a vibe.d application. Once a day it needs to
download some data. How do i get the program to perform this
task once a day?
Regards, Nick
You can use `Timer`. See `setTimer`/`createTimer` in
On Monday, 15 February 2016 at 03:22:44 UTC, Jon D wrote:
Is there a way to reserve capacity in associative arrays? In
some programs I've been writing I've been getting reasonable
performance up to about 10 million entries, but beyond that
performance is impacted considerably (say, 30 million
On Thursday, 28 January 2016 at 14:45:36 UTC, Adam D. Ruppe wrote:
On Thursday, 28 January 2016 at 14:39:46 UTC, sigod wrote:
I tried to compile your code on dpaste (2.070.0) and got this:
dpaste has an input mangling bug with some characters as a
result of the form submission over the web.
On Thursday, 4 February 2016 at 00:23:07 UTC, ixid wrote:
It would be nice to have a simple writeln that adds spaces
automatically like Python's 'print' in std.stdio, perhaps
called print.
It seems Andrei decided to add such function:
On Wednesday, 3 February 2016 at 19:21:06 UTC, Meta wrote:
On Wednesday, 3 February 2016 at 18:40:27 UTC, xtreak wrote:
Thanks. I was trying to get the return type of lambdas. I was
trying the following and got an error. I was using dpaste with
dmd 2.070
writeln(ReturnType!(a =(a *a)))
On Wednesday, 3 February 2016 at 22:27:07 UTC, holo wrote:
When i start same program on server in different timezone
difference is much higher (more than hour). Why it is
happening? Timezones shouldnt have influence on such equation.
Try using `Clock.currTime(UTC())`. And make sure all
On Thursday, 28 January 2016 at 13:26:27 UTC, Andrea Fontana
wrote:
On Thursday, 28 January 2016 at 13:18:55 UTC, pineapple wrote:
I experimented with using the character 'ħ' in a variable
name, and wasn't terribly surprised when the compiler didn't
like it. What did surprise me is that I
On Thursday, 28 January 2016 at 13:36:46 UTC, Puming wrote:
I have a function that reads a line of string and do some
computation.
I searched the forum and found that people use `const(char)[]`
or `in char[]` to accept both string and char[] arguments.
What's the difference between
Here's simple code:
import std.algorithm;
import std.array;
import std.file;
void main(string[] args)
{
auto t = args[1].readText()
.splitter('\n')
.filter!(e => e.length)
Well, problem boils down to `splitter` having a greater
constraints than most functions can meet.
Thanks everyone for clarification.
P.S. Maybe I should repost my question on SO? I really thought it
was a bug, so I posted it here.
On Tuesday, 27 October 2015 at 22:33:32 UTC, Adam D. Ruppe wrote:
On Tuesday, 27 October 2015 at 22:18:55 UTC, sigod wrote:
P.S. Maybe I should repost my question on SO? I really thought
it was a bug, so I posted it here.
You could, but I'd say the same thing there
I don't expect different
On Tuesday, 27 October 2015 at 21:54:33 UTC, Jonathan M Davis
wrote:
Well, split calls splitter, and it doesn't make much of an
attempt to check its arguments in its template constraint,
mostly passing the buck onto splitter, since it's really just a
wrapper around splitter that calls array on
On Tuesday, 27 October 2015 at 21:45:10 UTC, Ali Çehreli wrote:
On 10/27/2015 01:58 PM, sigod wrote:
Here's simple code:
import std.algorithm;
import std.array;
import std.file;
void main(string[] args)
{
auto t = args[1].readText()
On Tuesday, 27 October 2015 at 22:56:07 UTC, sigod wrote:
On Tuesday, 27 October 2015 at 22:33:32 UTC, Adam D. Ruppe
wrote:
On Tuesday, 27 October 2015 at 22:18:55 UTC, sigod wrote:
P.S. Maybe I should repost my question on SO? I really
thought it was a bug, so I posted it here.
You could,
On Sunday, 18 October 2015 at 21:01:05 UTC, holo wrote:
On Sunday, 18 October 2015 at 20:12:42 UTC, sigod wrote:
[...]
I changed it to such code:
...
auto client = HTTP(endpoint ~ "?" ~
canonicalQueryString);
client.method = HTTP.Method.get;
On Sunday, 18 October 2015 at 20:05:24 UTC, holo wrote:
@sigod
Actually im working on ec2 requests. Thank you for help, it is
working right now. I don't know why i was trying "+=" before
instead of "~=". Is it good solution to make it such way?
Not really as it will trigger allocation on
On Sunday, 18 October 2015 at 18:04:53 UTC, holo wrote:
I'm trying to receive data from curl request my sample code
looks like that:
...
auto client = HTTP(endpoint ~ "?" ~
canonicalQueryString);
client.method = HTTP.Method.get;
On Thursday, 12 February 2015 at 12:34:21 UTC, Vladimir Panteleev
wrote:
On Windows, if you are using the curl library included with DMD
2.066.1, curl will use the Windows certificate store.
Did this changed? I use 2.068.0 and still have problems with SSL.
Sorry for necroposting.
On Wednesday, 12 August 2015 at 15:21:28 UTC, GregoryP wrote:
I'm just wondering if, or how much of the following is possible
in some way in D:
class Foo {
int x;
sub Bar {
int x;
int getFooX(){ return super.x; }
sub FooBar {
int x;
int
On Tuesday, 11 August 2015 at 22:50:52 UTC, Clayton wrote:
Hello everyone,
Am looking for someone who could help review my code . As an
entry exercise to D am converting 3 C implementations of
popular pattern matching algorithms. The idea is to have 6
final implementations ( 3 compile-time
On Monday, 10 August 2015 at 16:02:31 UTC, bachmeier wrote:
On Monday, 10 August 2015 at 15:05:55 UTC, sigod wrote:
I see. But it's really counter intuitive after working with
C#. Probably documentation should stress out the difference.
Thanks, Adam.
I assume you mean this page:
On Monday, 10 August 2015 at 14:05:30 UTC, Adam D. Ruppe wrote:
On Monday, 10 August 2015 at 13:57:50 UTC, sigod wrote:
[...]
It does exactly what that says: rewrites it to
(a) {
return {
writeln(a);
};
}
which is returning a delegate.
[...]
So your code passed a delegate
On Monday, 10 August 2015 at 22:21:18 UTC, 岩倉 澪 wrote:
On Saturday, 8 August 2015 at 06:24:30 UTC, sigod wrote:
Use negative value for `receiveTimeout`.
http://stackoverflow.com/q/31616339/944911
actually this no longer appears to be true?
Passing -1.msecs as the duration gives me an
On Monday, 10 August 2015 at 22:21:18 UTC, 岩倉 澪 wrote:
On Saturday, 8 August 2015 at 06:24:30 UTC, sigod wrote:
Use negative value for `receiveTimeout`.
http://stackoverflow.com/q/31616339/944911
actually this no longer appears to be true?
Passing -1.msecs as the duration gives me an
On Monday, 10 August 2015 at 22:21:18 UTC, 岩倉 澪 wrote:
On Saturday, 8 August 2015 at 06:24:30 UTC, sigod wrote:
Use negative value for `receiveTimeout`.
http://stackoverflow.com/q/31616339/944911
actually this no longer appears to be true?
Passing -1.msecs as the duration gives me an
On Monday, 10 August 2015 at 22:31:33 UTC, sigod wrote:
On Monday, 10 August 2015 at 22:21:18 UTC, 岩倉 澪 wrote:
[...]
It should be this line:
https://github.com/D-Programming-Language/phobos/blob/master/std/concurrency.d#L1910
[...]
This lines still there:
From docs:
The following part = AssignExpression is rewritten to
FunctionLiteralBody:
{ return AssignExpression ; }
So, I wonder what happens when curly braces already in place?
Consider this example:
```
import std.algorithm;
import std.stdio;
void main() {
[1,2,3,4,5]
.each!(a
On Saturday, 8 August 2015 at 01:24:04 UTC, 岩倉 澪 wrote:
On Saturday, 8 August 2015 at 00:39:57 UTC, 岩倉 澪 wrote:
receiveTimeout(0.msecs,
(immutable Bar[] bar){ baz = cast(Bar[])bar;
});
Whoops, that should be:
receiveTimeout(0.msecs,
On Monday, 3 August 2015 at 22:42:15 UTC, SirNickolas wrote:
Hello! I'm new in D and it is amazing!
Can you tell me please if it is discouraged or deprecated to
call a function by just putting its name, without brackets?
It's quite unusual for me (used C++ and Python before), but I
can see
On Monday, 20 July 2015 at 14:40:59 UTC, jmh530 wrote:
I have found the documentation for each in std.algorithm a bit
terse. It seemed like it was an eager version of map, but it
seems to be a bit more limited than that.
Why are you trying to use `each` in place which belongs to `map`?
On Friday, 17 July 2015 at 09:07:29 UTC, Jarl André Hübenthal
wrote:
But its pretty nice to know that there is laziness in D, but
when I query mongo I expect all docs to be retrieved, since
there are no paging in the underlying queries? Thus, having a
lazy functionality on top of non lazy db
On Friday, 17 July 2015 at 15:41:22 UTC, ZombineDev wrote:
eager approach, since it's more straightforward.
What makes you think it's always more straightforward? Sometimes
(like in this case with MongoDB) you cannot write eager approach
without first writing lazy one.
On Monday, 6 July 2015 at 10:20:28 UTC, anonymous wrote:
On Monday, 6 July 2015 at 07:48:17 UTC, sigod wrote:
Aren't compiler smart enough to prevent it?
```
ubyte[] test1()
{
auto b = sha1Of();
return b; // Error: escaping reference to local b
}
ubyte[] test2()
{
On Monday, 6 July 2015 at 14:56:38 UTC, Marc Schütz wrote:
On Monday, 6 July 2015 at 10:20:28 UTC, anonymous wrote:
dmd 2.068.0 catches this. You can get the beta here:
http://downloads.dlang.org/pre-releases/2.x/2.068.0/
... and it already contains a std.digest.hmac module :-)
Yes, thanks.
On Monday, 6 July 2015 at 05:30:46 UTC, thedeemon wrote:
On Sunday, 5 July 2015 at 18:57:46 UTC, sigod wrote:
Why does function return incorrect data? Using `.dup` in
return expression or using `ubyte[20]` as return type fixes
problem, but why?
Because sha1Of() returns ubyte[20], this is a
Consider this code:
```
import std.digest.digest;
import std.stdio;
ubyte[] hmac_sha1(const(ubyte)[] key, const(ubyte)[] message)
{
import std.digest.sha;
enum block_size = 64;
if (key.length block_size)
key = sha1Of(key);
if (key.length
Hi, everyone.
```
import std.typecons : Nullable;
class Test {}
Nullable!Test test;
assert(test.isNull);
```
Why does `Nullable` allowed to be used with reference types (e.g.
classes)?
P.S. I have experience with C#, where `NullableT` cannot be
used with reference types. And it sounds
On Monday, 29 June 2015 at 20:12:12 UTC, Assembly wrote:
I believe it's a design choice, if so, could someone explain
why? is immutable better than C#'s readonly so that the
readonly keyword isn't even needed? for example, I'd like to
declare a member as readonly but I can't do it directly
On Monday, 29 June 2015 at 22:22:46 UTC, anonymous wrote:
On Monday, 29 June 2015 at 22:11:16 UTC, sigod wrote:
`new immutable(MyClass)()` is invalid code.
It's perfectly fine, actually.
Yes, you're right. It seems I've mistyped `immutable` when was
checking it with compiler.
On Tuesday, 23 June 2015 at 23:52:52 UTC, Adam D. Ruppe wrote:
On Tuesday, 23 June 2015 at 23:14:13 UTC, Steven Schveighoffer
wrote:
I'm not completely sure on the syntax, try adding some parens.
Yeah, I'm pretty sure it needs to be
@(full.name.here) void foo()
Yep, something like this
On Sunday, 7 June 2015 at 15:39:17 UTC, Marc Schütz wrote:
On Sunday, 7 June 2015 at 15:17:27 UTC, 1967 wrote:
I've got a template that takes in a type. Sometimes the type
is a class, sometimes a struct, sometimes just an int. It
doesn't much matter what it is, but if it's a reference type I
Hi. I have few questions about this piece of code.
```
import vibe.data.serialization;
struct User
{
@name(_id) int id; // Error: function expected before (), not
name of type string
string name;
}
```
Is it even proper compiler behavior? Is there any way to bypass
it without using
On Tuesday, 23 June 2015 at 22:10:43 UTC, Steven Schveighoffer
wrote:
You can use @full.path.name
```
Error: unexpected ( in declarator
Error: basic type expected, not _id
Error: found '_id' when expecting ')'
Error: no identifier for declarator .data.serialization.name(int)
Error: semicolon
On Sunday, 24 August 2014 at 02:53:41 UTC, Damian Day wrote:
isImplicitlyConvertible!(ElementType!R, T))
Try [ElementEncodingType][0].
[0]: http://dlang.org/phobos/std_range.html#ElementEncodingType
On Saturday, 23 August 2014 at 16:28:46 UTC, novice2 wrote:
I have 2 reduced files, wich i can't compile with new (DMD
2.066) rdmd.exe under Windows 7 32-bit.
Command: rdmd --force --build-only aaa.d
Message Error 42: Symbol Undefined _D3etc3bbb3fooFZi
But command: dmd aaa.d etc\bbb.d
Compile
PR that introduced regression:
https://github.com/D-Programming-Language/tools/pull/108
On Saturday, 23 August 2014 at 17:32:15 UTC, Vladimir Panteleev
wrote:
No, it is not an rdmd bug.
etc is a standard D package name reserved for Phobos, the
standard library. It is the same for std and core.
Please, point us directly to a documentation where it says that
this words reserved.
On Saturday, 23 August 2014 at 17:41:38 UTC, Dicebot wrote:
On Saturday, 23 August 2014 at 17:37:39 UTC, sigod wrote:
On Saturday, 23 August 2014 at 17:32:15 UTC, Vladimir
Panteleev wrote:
No, it is not an rdmd bug.
etc is a standard D package name reserved for Phobos, the
standard library.
On Saturday, 23 August 2014 at 18:28:32 UTC, Vladimir Panteleev
wrote:
On Saturday, 23 August 2014 at 18:23:25 UTC, sigod wrote:
Isn't it better to document such things?
Yes. Please create a pull request.
Easy to say. In my TODO list lies record to create PR for [this
issue][0]. Today is
On Wednesday, 6 August 2014 at 18:33:23 UTC, Dicebot wrote:
Most voted DMD bug :
https://issues.dlang.org/show_bug.cgi?id=314
+1 vote from me.
On Saturday, 2 August 2014 at 06:46:04 UTC, Jonathan M Davis via
Digitalmars-d-learn wrote:
On Fri, 01 Aug 2014 23:09:37 +
sigod via Digitalmars-d-learn
digitalmars-d-learn@puremagic.com wrote:
Code: http://dpaste.dzfl.pl/51bd62138854
(It was reduced by DustMite.)
Have I missed
Code: http://dpaste.dzfl.pl/51bd62138854
(It was reduced by DustMite.)
Have I missed something about structs? Or this simply a bug?
On Saturday, 26 July 2014 at 20:49:30 UTC, seany wrote:
Can a function return a function in D? Sorry if i missed the
answer somewhere
Just alias your function signature:
```d
alias MyFunctionType = void function(int);
```
Example from my own code:
```d
alias DeserializeBody = TLObject
On Sunday, 20 July 2014 at 15:54:15 UTC, bearophile wrote:
mixin template Vala2(uint count, alias arr) {
What about disallowing mixin templatename unless you add
mixin before the template keyword?
Bye,
bearophile
I thought it's disallowed.
On Tuesday, 15 July 2014 at 08:31:10 UTC, pgtkda wrote:
How can i get all folders from a given path?
If I understood you correctly:
http://dlang.org/phobos/std_file.html#.dirEntries
On Sunday, 13 July 2014 at 11:18:05 UTC, bearophile wrote:
The idea of not making std.algorithm.among!() a predicate was
not so good:
void main() {
import std.stdio, std.algorithm;
auto s = hello how\nare you;
s.until!(c = c.among!('\n', '\r')).writeln;
}
(A normal workaround is
On Thursday, 10 July 2014 at 17:30:17 UTC, Sean Campbell wrote:
if I need to Concatenate ints I'l just use a recursive pow
based on length
int ConcatInt(int[] anint){
int total = 0;
for(int i=0;ianint.length;i++){
total += anint[i]*10^^(anint.length-i-1);
On Thursday, 10 July 2014 at 20:59:17 UTC, simendsjo wrote:
Strings behaves a bit odd with is(). The following passes:
import std.stdio;
void f(string a, string b) {
assert(a is b); // also true
}
void main() {
string a = aoeu;
string b = aoeu;
assert(a is b); // true
f(a,
On Thursday, 26 June 2014 at 16:50:38 UTC, Lemonfiend wrote:
This doesn't (why?):
auto s = SList!int(1, 2, 3, 4, 5);
auto s2 = SList!int(1, 2, 3, 4, 5);
auto r = s2[];
popFrontN(r, 1);
auto r1 = s.linearRemove(r);
This is intended behavior:
https://issues.dlang.org/show_bug.cgi?id=12999
```
import std.process : Config_ = Config;
```
Sorry, wrong one.
There seems no solution for this. So, you must use fully
qualified name.
Take a look at unittests in [std.container.slist][0]:
```
unittest
{
auto s = SList!int(1, 2, 3, 4, 5);
auto r = s[];
popFrontN(r, 3);
auto r1 = s.linearRemove(r);
assert(s == SList!int(1, 2, 3));
assert(r1.empty);
}
unittest
{
auto s = SList!int(1, 2, 3, 4, 5, 6, 7,
Dirty solution:
```
import scriptlike;
import your_module;
import your_module : Config;
```
So, `Config` from your module will override one from scriptlike.
First case is a bug. I'll make pull request.
Not sure about second.
I opened new issue: https://issues.dlang.org/show_bug.cgi?id=12986
E.g.:
module.d: (or just `module module;` in source file)
```
import std.stdio;
void main() {
foreach (m; __traits(allMembers, mixin(__MODULE__))) { //
module.d-mixin-4(4): Error: expression expected, not 'module'
writeln(m);
}
}
```
Documentation says:
Package names cannot
On Sunday, 22 June 2014 at 12:52:11 UTC, sigod wrote:
module.d: (or just `module module;` in source file)
I was wrong about `module module;` declaration.
This question seems more fit for the main D newsgroup.
Should I create new thread in the main newsgroup?
Look in Bugzilla if there is a enhancement request.
Yeah. I found one: https://issues.dlang.org/show_bug.cgi?id=456
In the video Case Studies In Simplifying Code With Compile-Time
Reflection [was pointed out][0] that it is possible to reflect
on imported packages.
So, I tried:
reflection.d:
```
import std.stdio;
import test.module1;
import test.module2;
void main() {
foreach (m;
On Monday, 16 June 2014 at 16:49:46 UTC, Andrew Brown wrote:
ulong[string] dictionary; // the length property is ulong,
not
uint
Actually length is size_t (uint on x86 and ulong on x64).
On Monday, 9 June 2014 at 15:54:21 UTC, Ivan Kazmenko wrote:
I'd expect a multiple overrides of same function error, much
like if I just paste the mixin code by hand. Is that a bug or
working by design? In the latter case, please explain the
reasoning.
http://dlang.org/template-mixin.html
On Thursday, 8 May 2014 at 07:33:34 UTC, Philippe Sigaud via
Digitalmars-d-learn wrote:
A workaround is to wrap it into another template, to 'hide'
__traits.
Like this:
alias Alias(alias a) = a; // A bit circular, I know.
Oh, thank you.
I think there is bug report / enhancement for this. I
On Friday, 9 May 2014 at 01:02:39 UTC, FrankLike wrote:
Hi,everyone,
down VisulaD from
http://rainers.github.io/visuald/visuald/StartPage.html
found the virus:Win32.Troj.Undef.(kcloud)
Why?
Frank
void registerAll(alias module_)()
{
foreach (m; __traits(derivedMembers, module_)) {
regInner!(__traits(getMember, module_, m)); // compiles
alias a = __traits(getMember, module_, m); // fails
//Error: basic type expected, not __traits
//Error: semicolon
86 matches
Mail list logo