Re: why std.stdio.File is a struct?

2016-10-23 Thread Jonathan M Davis via Digitalmars-d
On Sunday, October 23, 2016 06:13:29 lumpyzhu via Digitalmars-d wrote: > thanks.. > but structs are copy by value, > In C++, I can use reference to avoid value-copy, > > -- > class MyClass {}; > void myFunc(const MyClass& a, MyClass& b) {...}; > > { >

[Issue 16634] New: std.math exposes yl2x and yl2xp1 publicly

2016-10-23 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16634 Issue ID: 16634 Summary: std.math exposes yl2x and yl2xp1 publicly Product: D Version: D2 Hardware: All OS: All Status: NEW Severity: normal

Re: getting started with web server - vibe.d dub giving link error

2016-10-23 Thread Karabuta via Digitalmars-d-learn
On Sunday, 23 October 2016 at 14:53:48 UTC, aman wrote: On Saturday, 22 October 2016 at 17:23:58 UTC, Karabuta wrote: [...] This time i started out with a fresh Ubuntu server and followed instructions on the blog. Here's output. Please help:-

Re: [OT] fastest fibbonacci

2016-10-23 Thread Minas Mina via Digitalmars-d
On Sunday, 23 October 2016 at 13:04:30 UTC, Stefam Koch wrote: Hi Guys, while brushing up on my C and algorithm skills, accidently created a version of fibbonaci which I deem to be faster then the other ones floating around. It's also more concise the code is : int computeFib(int n) {

get regex string pattern from regex object

2016-10-23 Thread aman via Digitalmars-d
How can I get the string regex pattern from a regex object? I tried this and obviously didn't work. my expected output would be "hello hi".i.e. the string used to create the regex in the first place. static rx = ctRegex!`hello hi`; void main() { writeln(to!(string)(rx)); }

Re: No trace of cumulativeFold except in the source.

2016-10-23 Thread Jonathan M Davis via Digitalmars-d-learn
On Sunday, October 23, 2016 10:10:40 e-y-e via Digitalmars-d-learn wrote: > On Sunday, 23 October 2016 at 09:11:08 UTC, Jonathan M Davis > > wrote: > > On Sunday, October 23, 2016 07:46:19 e-y-e via > > > > Digitalmars-d-learn wrote: > >> ... > > > > It's not a bug. It's just too new. You looked

[Issue 15862] Functions that return types with mutable indirections should be weakly pure, not strongly pure

2016-10-23 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=15862 github-bugzi...@puremagic.com changed: What|Removed |Added Status|REOPENED|RESOLVED

[Issue 15862] Functions that return types with mutable indirections should be weakly pure, not strongly pure

2016-10-23 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=15862 --- Comment #14 from github-bugzi...@puremagic.com --- Commits pushed to master at https://github.com/dlang/dmd https://github.com/dlang/dmd/commit/4dfc9e9252220ef724412a74b3a8caf862d0a95e fix Issue 15862 - allocating storage in pure functions

[Issue 16635] Alias this for implicit conversion to "ref typeof(this)" causes dmd to run endlessly

2016-10-23 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16635 Sprink changed: What|Removed |Added Severity|enhancement |normal --

[Issue 16635] New: Alias this for implicit conversion to "ref typeof(this)" causes dmd to run endlessly

2016-10-23 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16635 Issue ID: 16635 Summary: Alias this for implicit conversion to "ref typeof(this)" causes dmd to run endlessly Product: D Version: D2 Hardware: x86_64 OS: Linux

Re: Pattern matching in D?

2016-10-23 Thread Chris M via Digitalmars-d
On Friday, 21 October 2016 at 19:00:55 UTC, Nick Sabalausky wrote: On 10/20/2016 10:16 PM, 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 Rust's match

Re: [OT] fastest fibbonacci

2016-10-23 Thread safety0ff via Digitalmars-d
On Sunday, 23 October 2016 at 13:04:30 UTC, Stefam Koch wrote: created a version of fibbonaci which I deem to be faster then the other ones floating around. Rosettacode is a good place to check for "floating around" implementations of common practice exercises e.g.:

Re: No trace of cumulativeFold except in the source.

2016-10-23 Thread e-y-e via Digitalmars-d-learn
On Sunday, 23 October 2016 at 10:19:07 UTC, Jonathan M Davis wrote: On Sunday, October 23, 2016 10:10:40 e-y-e via Digitalmars-d-learn wrote: ... Per http://dlang.org/changelog/2.071.0.html 2.071.0 came out at the beginning of April, and 2.072 has been slow in coming, so we've only had

Re: New to D

2016-10-23 Thread Daniel Kozak via Digitalmars-d-learn
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

Re: No trace of cumulativeFold except in the source.

2016-10-23 Thread e-y-e via Digitalmars-d-learn
On Sunday, 23 October 2016 at 09:11:08 UTC, Jonathan M Davis wrote: On Sunday, October 23, 2016 07:46:19 e-y-e via Digitalmars-d-learn wrote: ... It's not a bug. It's just too new. You looked at the master branch on github, whereas what you're probably using on your computer is 2.071.2,

Re: why std.stdio.File is a struct?

2016-10-23 Thread Namespace via Digitalmars-d
On Sunday, 23 October 2016 at 06:36:21 UTC, Jonathan M Davis wrote: You can mark a parameter as ref, and you get something similar to C++'s &, except that it only works on parameters, return types, and the variable for the current element in a foreach loop (you can't declare local variables

[OT] fastest fibbonacci

2016-10-23 Thread Stefam Koch via Digitalmars-d
Hi Guys, while brushing up on my C and algorithm skills, accidently created a version of fibbonaci which I deem to be faster then the other ones floating around. It's also more concise the code is : int computeFib(int n) { int t = 1; int result = 0; while(n--) {

Re: "for" statement issue

2016-10-23 Thread Nick Treleaven via Digitalmars-d
On Saturday, 22 October 2016 at 17:11:26 UTC, ag0aep6g wrote: How is it guaranteed that `a` doesn't have side effects? May be a function call, since empty parentheses can be omitted in calls. I missed that case. (Insert grumble about non-UFCS parenthesis omission being allowed). The

Re: why std.stdio.File is a struct?

2016-10-23 Thread lumpyzhu via Digitalmars-d
On Thursday, 20 October 2016 at 07:40:05 UTC, Jonathan M Davis wrote: On Thursday, October 20, 2016 06:59:12 lumpyzhu via Digitalmars-d wrote: std.stdio.File has reference counter inside, why not std.stdio.File is class? By using a struct with a reference count, you get deterministic

No trace of cumulativeFold except in the source.

2016-10-23 Thread e-y-e via Digitalmars-d-learn
Recently I needed to use a cumulative sum function, so I looked in phobos' documentation for 'cumulative' but found nothing useful. Then I looked in the forums for it and found nothing useful. But when I searched phobos for it I found cumulativeFold in std.algorithm.iteration:

Re: No trace of cumulativeFold except in the source.

2016-10-23 Thread Jonathan M Davis via Digitalmars-d-learn
On Sunday, October 23, 2016 07:46:19 e-y-e via Digitalmars-d-learn wrote: > Recently I needed to use a cumulative sum function, so I looked > in phobos' documentation for 'cumulative' but found nothing > useful. Then I looked in the forums for it and found nothing > useful. But when I searched

Re: getting started with web server - vibe.d dub giving link error

2016-10-23 Thread aman via Digitalmars-d-learn
On Saturday, 22 October 2016 at 17:23:58 UTC, Karabuta wrote: On Saturday, 22 October 2016 at 17:21:45 UTC, Karabuta wrote: On Saturday, 22 October 2016 at 14:50:14 UTC, aman wrote: I just started on vibe.d on fedora and the experience is not pretty getting hello-world running. Please help.

Re: If you do something dumb enough, the test runner won't print out your test failures

2016-10-23 Thread Vladimir Panteleev via Digitalmars-d
On Sunday, 23 October 2016 at 21:52:26 UTC, Jonathan M Davis wrote: LOL. This was too funny not to share. I had a unittest failure in a project that I'm working on, and dub ended up just printing out Nice story, thanks for sharing :) You can change your shell prompt so it displays the exit

[Issue 16626] [Reg 2.073] recent dmd nightly runs out of memory building Higgs

2016-10-23 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16626 --- Comment #2 from Martin Nowak --- >From Dmitry https://github.com/dlang/phobos/pull/4286#issuecomment-255182046 > The new version is more demanding on memory during CTFE so yeah, most likely > it now fails for some patterns. Dunno

If you do something dumb enough, the test runner won't print out your test failures

2016-10-23 Thread Jonathan M Davis via Digitalmars-d
LOL. This was too funny not to share. I had a unittest failure in a project that I'm working on, and dub ended up just printing out Program exited with code 1 rather than printing out the actual failures, which was not exactly useful. And I thought that dub must have a bug, so I started trying

Re: If you do something dumb enough, the test runner won't print out your test failures

2016-10-23 Thread Jonathan M Davis via Digitalmars-d
On Sunday, October 23, 2016 21:58:30 Vladimir Panteleev via Digitalmars-d wrote: > You can change your shell prompt so it displays the exit code of > the last command. It's something frequently seen in people's > custom prompts. (Here's mine: > https://github.com/CyberShadow/cyberzshadow) Wow,

Re: [OT] fastest fibbonacci

2016-10-23 Thread Timon Gehr via Digitalmars-d
On 23.10.2016 21:59, Minas Mina wrote: On Sunday, 23 October 2016 at 13:04:30 UTC, Stefam Koch wrote: Hi Guys, while brushing up on my C and algorithm skills, accidently created a version of fibbonaci which I deem to be faster then the other ones floating around. It's also more concise the

Re: [OT] fastest fibbonacci

2016-10-23 Thread Stefam Koch via Digitalmars-d
On Sunday, 23 October 2016 at 19:59:16 UTC, Minas Mina wrote: On Sunday, 23 October 2016 at 13:04:30 UTC, Stefam Koch wrote: Hi Guys, while brushing up on my C and algorithm skills, accidently created a version of fibbonaci which I deem to be faster then the other ones floating around.

Re: [OT] fastest fibbonacci

2016-10-23 Thread Stefam Koch via Digitalmars-d
On Sunday, 23 October 2016 at 15:12:37 UTC, Timon Gehr wrote: On 23.10.2016 15:04, Stefam Koch wrote: Hi Guys, while brushing up on my C and algorithm skills, accidently created a version of fibbonaci which I deem to be faster then the other ones floating around. It's also more concise

[Issue 16517] topN performance very poor on certain data sets

2016-10-23 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16517 Andrei Alexandrescu changed: What|Removed |Added Status|NEW |RESOLVED

Re: getting started with web server - vibe.d dub giving link error

2016-10-23 Thread aman via Digitalmars-d-learn
On Saturday, 22 October 2016 at 17:23:58 UTC, Karabuta wrote: On Saturday, 22 October 2016 at 17:21:45 UTC, Karabuta wrote: On Saturday, 22 October 2016 at 14:50:14 UTC, aman wrote: I just started on vibe.d on fedora and the experience is not pretty getting hello-world running. Please help.

Using a specific version of DMD in Travic CI fails

2016-10-23 Thread Jacob Carlborg via Digitalmars-d
Posting here as well to get some more eyes on the issue. https://github.com/travis-ci/travis-ci/issues/6770 -- /Jacob Carlborg

[Issue 16625] [Reg 2.072] new and previously undeprecated switch case fallthrough error

2016-10-23 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16625 --- Comment #2 from github-bugzi...@puremagic.com --- Commits pushed to stable at https://github.com/dlang/dmd https://github.com/dlang/dmd/commit/d8075dc0581ae1da6e27762689a2d902f4c0947e fix Issue 16625 - undeprecated switch fallthrough error

Re: [OT] fastest fibbonacci

2016-10-23 Thread Timon Gehr via Digitalmars-d
On 23.10.2016 17:42, Stefam Koch wrote: On Sunday, 23 October 2016 at 15:12:37 UTC, Timon Gehr wrote: On 23.10.2016 15:04, Stefam Koch wrote: Hi Guys, while brushing up on my C and algorithm skills, accidently created a version of fibbonaci which I deem to be faster then the other ones

Re: [OT] fastest fibbonacci

2016-10-23 Thread Andrei Alexandrescu via Digitalmars-d
On 10/23/16 12:32 PM, Timon Gehr wrote: It uses a general technique to speed up computation of linear recurrences Would be awesome to factor this out of the particular algorithm. I recall SICP famously does that with a convergence accelerating technique for series. -- Andrei

Re: [OT] fastest fibbonacci

2016-10-23 Thread Timon Gehr via Digitalmars-d
On 23.10.2016 15:04, Stefam Koch wrote: Hi Guys, while brushing up on my C and algorithm skills, accidently created a version of fibbonaci which I deem to be faster then the other ones floating around. It's also more concise the code is : int computeFib(int n) { int t = 1; int result

[Issue 16627] [Reg 2.072] struct with disabled postblit field is now nested

2016-10-23 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16627 --- Comment #2 from Martin Nowak --- This happens because structs are converted to nested structs by the semantic analysis of their member functions. The idea behind this seems to be that struct without methods can't access the outer

[Issue 16627] [Reg 2.072] non-static structs with postblit/dtor fields are now nested

2016-10-23 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16627 Martin Nowak changed: What|Removed |Added Summary|[Reg 2.072] struct with |[Reg 2.072] non-static

Re: If you do something dumb enough, the test runner won't print out your test failures

2016-10-23 Thread Nick Sabalausky via Digitalmars-d
On 10/23/2016 05:52 PM, Jonathan M Davis via Digitalmars-d wrote: import core.sys.posix.unistd; unittest { close(2); assert("hello" == "7"); } Ouch! I like the punchline here :) However, it does highlight the fact that if you just look at the output of running the unit tests and

Re: getting started with web server - vibe.d dub giving link error

2016-10-23 Thread aman via Digitalmars-d-learn
On Sunday, 23 October 2016 at 19:23:04 UTC, Karabuta wrote: On Sunday, 23 October 2016 at 14:53:48 UTC, aman wrote: On Saturday, 22 October 2016 at 17:23:58 UTC, Karabuta wrote: [...] This time i started out with a fresh Ubuntu server and followed instructions on the blog. Here's output.

Re: Pattern matching in D?

2016-10-23 Thread Nick Sabalausky via Digitalmars-d
On 10/23/2016 03:38 PM, Chris M wrote: On Friday, 21 October 2016 at 19:00:55 UTC, Nick Sabalausky wrote: What I've been really wanting for a long time is the one-two combo of Nemerle's variants and pattern matching: https://github.com/rsdn/nemerle/wiki/Grok-Variants-and-matching There is

Re: Pattern matching in D?

2016-10-23 Thread Nick Sabalausky via Digitalmars-d
On 10/23/2016 11:55 PM, Nick Sabalausky wrote: // An equivalent std.variant.Algebraic would be clunky by comparison: variant RgbColor { | Red | Yellow | Green | Different { red : float; green : float; blue : float;

How to get sqlite3.lib x64?

2016-10-23 Thread Andre Pany via Digitalmars-d-learn
Hi, I try to get sqlite3.lib for 64 Bit windows os. I tried implib with the def file and the 64 Bit dll: implib sqlite3_implib.lib sqlite3.def /system -> App crash (Windows 10) With the dll file defined: implib sqlite3_implib.lib sqlite3.dll /system -> Error message: Error(10): Error: cannot