Re: GDC on Travis-CI

2018-06-02 Thread Seb via Digitalmars-d-learn
On Saturday, 2 June 2018 at 16:04:09 UTC, Matthias Klumpp wrote: On Saturday, 2 June 2018 at 03:15:56 UTC, crimaniak wrote: I started to work with Travis-CI, building packages using all three main compilers, and noticed that I have problems with gdc every time and need to tweak code because of

Re: Stack traces with DMD on OSX

2018-05-31 Thread Seb via Digitalmars-d-learn
On Thursday, 31 May 2018 at 09:11:41 UTC, pineapple wrote: When I run code on OSX and it produces a stack trace, the output uses mangled symbols and is missing line numbers, like so - how can I change these stack traces to be more readable? [...] Use DMD master - support for line numbers in

Re: Building dmd/druntime on windows issue

2018-05-10 Thread Seb via Digitalmars-d-learn
On Thursday, 10 May 2018 at 18:38:30 UTC, Andre Pany wrote: Hi, I follow the instructions from the wiki to build dmd/druntime from source on windows. https://wiki.dlang.org/Building_under_Windows [...] Which DMD/druntime do you try to build? IIRC there are some issues with the release ball,

Re: "Start a Minimal web server" example do not work.

2018-05-08 Thread Seb via Digitalmars-d-learn
On Tuesday, 8 May 2018 at 18:40:34 UTC, BoQsc wrote: On Tuesday, 8 May 2018 at 18:38:10 UTC, BoQsc wrote: On Tuesday, 8 May 2018 at 17:35:13 UTC, Jesse Phillips wrote: [...] Tested with these versions so far, and had all the same errors: C:\Users\Vaidas>dmd --version DMD32 D Compiler v2.079.1

Re: "Start a Minimal web server" example do not work.

2018-05-08 Thread Seb via Digitalmars-d-learn
On Tuesday, 8 May 2018 at 12:37:42 UTC, BoQsc wrote: On Tuesday, 8 May 2018 at 12:19:14 UTC, Adam D. Ruppe wrote: On Tuesday, 8 May 2018 at 12:13:56 UTC, BoQsc wrote: [...] This one needs to be compiled+run with the dub package manager instead of with rdmd, which is why it has that shebang l

Re: Digger v3.0 alpha 5 / DMD 2.080.0 / Can't build...

2018-05-02 Thread Seb via Digitalmars-d-learn
On Wednesday, 2 May 2018 at 21:13:03 UTC, Robert M. Münch wrote: On 2018-05-02 09:39:41 +, Seb said: [...] Hi, not that I know about... [...] Looks like it's an issue with the windows bootstrapping. I would recommend to report a bug to Vladimir's issue tracker: https://github.com/Cyber

Re: Digger v3.0 alpha 5 / DMD 2.080.0 / Can't build...

2018-05-02 Thread Seb via Digitalmars-d-learn
On Wednesday, 2 May 2018 at 09:36:23 UTC, Robert M. Münch wrote: Hi, digger won't build because it sees some local changes to file, which I didn't do: [...] Works fine for me with 2.080.0. Did you maybe modify your working directory locally? If so, try nuking `work` away. (btw digger is us

Re: Passing to c++ std::string and vector

2018-04-30 Thread Seb via Digitalmars-d-learn
On Monday, 30 April 2018 at 01:07:35 UTC, NewUser wrote: Hi, How do I pass a d string to a c++ std::string? NewUser There's https://github.com/dlang/druntime/pull/1316 (an attempt at making C++ standard library)

Re: trouble building dlang.org

2018-04-13 Thread Seb via Digitalmars-d-learn
On Tuesday, 10 April 2018 at 15:58:10 UTC, Zach Tollen wrote: I'm trying to update the language spec. I have the standard dmd installed on my Mac in `~/dlang/dmd` using the install script from the website "curl -fsS https://dlang.org/install.sh | bash -s dmd". Okay, good, done. Actually no D

Re: Using iteration / method chaining / etc on multi-dimensional arrays

2018-04-12 Thread Seb via Digitalmars-d-learn
On Thursday, 12 April 2018 at 15:38:34 UTC, Chris Katko wrote: I googled but couldn't find any clear solution. I've got a 2-D array of strings read from a text file I parsed. So it's like 0 1 15 0 0 2 12 1 0 0 ... 0 1 0 10 0 They come in with spaces, so I join into an array between them. Bu

Re: Source expression passed to a lazy parameter

2018-04-09 Thread Seb via Digitalmars-d-learn
On Monday, 9 April 2018 at 13:03:38 UTC, Simen Kjærås wrote: On Monday, 9 April 2018 at 11:33:56 UTC, Alex wrote: On Monday, 9 April 2018 at 09:20:42 UTC, Simen Kjærås wrote: Nope. Something along the lines of __traits(getSource, arg) has been discussed occasionally. Is this available somehow

Re: HTTP-methods and encoding

2018-04-07 Thread Seb via Digitalmars-d-learn
On Saturday, 7 April 2018 at 13:02:39 UTC, Vindex wrote: There is an error on some sites when using HTTP-methods (std.net.curl.get, std.net.curl.post): std.encoding.EncodingException@std/encoding.d(2505): Unrecognized Encoding: utf8 Is there a beautiful way around it? For the GET-method I use

Re: Making emplaceRef public

2018-04-06 Thread Seb via Digitalmars-d-learn
On Friday, 6 April 2018 at 17:46:26 UTC, Per Nordlöw wrote: Why isn't `std.conv.emplaceRef` public when `std.conv.emplace` is? AFAICT, emplaceRef(x, ...) is a bit more @safe than emplace(&x, ...) ... I had the same thoughts too: https://issues.dlang.org/show_bug.cgi?id=18701 We can even

Re: Idiomatic error handling for ranges

2018-04-05 Thread Seb via Digitalmars-d-learn
On Thursday, 5 April 2018 at 17:06:04 UTC, rumbu wrote: Is there a standard way to handle errors in a chain of range transformations? [...] Are you aware of ifThrown? https://dlang.org/phobos/std_exception.html#ifThrown It's not perfect, but imho a nice start and one of the places where la

Re: merkle reverse

2018-04-05 Thread Seb via Digitalmars-d-learn
On Thursday, 5 April 2018 at 09:24:31 UTC, SimonN wrote: On Thursday, 5 April 2018 at 09:07:52 UTC, Seb wrote: FYI: The problem isn't chunks, but that strings aren't bi-directional ranges (hello ugly auto-decoding!). "4a5e1e4baab89f3a32518a88c31bc87f618f76673e2cc77ab2127b7afdeda33b".byCodeUnit

Re: merkle reverse

2018-04-05 Thread Seb via Digitalmars-d-learn
On Thursday, 5 April 2018 at 08:57:11 UTC, SimonN wrote: On Thursday, 5 April 2018 at 08:12:38 UTC, aerto wrote: This is the bitcoin genesis block merkle root 4a5e1e4baab89f3a32518a88c31bc87f618f76673e2cc77ab2127b7afdeda33b how i can get it at this format 3ba3edfd7a7b12b27ac72c3e67768f617fc81bc3

Re: is this even possible? newbie + mixin template + foreach (allMembers)

2018-04-03 Thread Seb via Digitalmars-d-learn
On Tuesday, 3 April 2018 at 18:49:00 UTC, Carlos Navarro wrote: QUESTION: Obviously I'm no geting mixins/templates nor traits and I'm failing miserably to find/identify the right examples or documentation to help me tackle this thing. What is wrong in this code? is this pattern sintactically

Re: Why toUTF8 not accept wchar[] as argument?

2018-04-02 Thread Seb via Digitalmars-d-learn
On Tuesday, 3 April 2018 at 02:46:51 UTC, Domain wrote: On Tuesday, 3 April 2018 at 02:31:15 UTC, Uknown wrote: On Tuesday, 3 April 2018 at 02:24:08 UTC, Domain wrote: wchar[10] buffer; toUTF8(buffer); Error: template `std.utf.toUTF8` cannot deduce function from argument types `!()(wchar[10])

Re: @property for simple methods?

2018-04-02 Thread Seb via Digitalmars-d-learn
On Monday, 2 April 2018 at 14:51:57 UTC, Vladimirs Nordholm wrote: On Monday, 2 April 2018 at 14:20:49 UTC, Dennis wrote: On Monday, 2 April 2018 at 13:57:14 UTC, Vladimirs Nordholm wrote: Is there any reason for me to add the @property tags for the method? A list of things the @property tag

Re: Constructor qualifiers; bug or expected behavior?

2018-04-02 Thread Seb via Digitalmars-d-learn
On Monday, 2 April 2018 at 11:41:55 UTC, Eduard Staniloiu wrote: On Monday, 2 April 2018 at 10:26:32 UTC, RazvanN wrote: [...] The compiler does an implicit conversion from the type `immutable B` to the type `B`. It is able to do safely do so because `struct B` has only value types that can

Re: Optional parameters?

2018-04-01 Thread Seb via Digitalmars-d-learn
On Sunday, 1 April 2018 at 15:54:16 UTC, Steven Schveighoffer wrote: I currently have a situation where I want to have a function that accepts a parameter optionally. I thought maybe Nullable!int might work: void foo(Nullable!int) {} void main() { foo(1); // error int x; foo(x); // e

Re: auto-decoding

2018-04-01 Thread Seb via Digitalmars-d-learn
On Sunday, 1 April 2018 at 02:44:32 UTC, Uknown wrote: If you want to stop auto-decoding, you can use std.string.representation like this: import std.string : representation; auto no_decode = some_string.representation; Now no_decode wont be auto-decoded, and you can use it in place of some_s

Re: Fast GC allocation of many small objects

2018-03-31 Thread Seb via Digitalmars-d-learn
On Saturday, 31 March 2018 at 19:38:31 UTC, Per Nordlöw wrote: On Saturday, 31 March 2018 at 19:31:37 UTC, Rubn wrote: Be willing to change your code, the allocator can change at any point. What you implement today may not work tomorrow, what you fix to work for tomorrow may not end up working

Re: How to customize vibe.data.json

2018-03-30 Thread Seb via Digitalmars-d-learn
On Friday, 30 March 2018 at 16:47:52 UTC, kerdemdemir wrote: Hi, In vibe's web page(http://vibed.org/api/vibe.data.json/serializeToJson) it is told that I should implement [...] I think you are looking for this - https://github.com/vibe-d/vibe.d/pull/2088 Feel free to ping the people th

Re: string to hex convert

2018-03-29 Thread Seb via Digitalmars-d-learn
On Thursday, 29 March 2018 at 20:29:39 UTC, aerto wrote: how i can convert Hello world! to hex 48656c6c6f20776f726c6421 ?? --- import std.format, std.stdio; void main() { writeln("Hello World!".format!("%(%02X%)")); } --- https://run.dlang.io/is/acz7kV

Re: Building application with LDC and -flto=thin fails in link stage

2018-03-28 Thread Seb via Digitalmars-d-learn
On Wednesday, 28 March 2018 at 16:42:23 UTC, Johan Engelen wrote: On Tuesday, 27 March 2018 at 22:10:33 UTC, Per Nordlöw wrote: On Tuesday, 27 March 2018 at 22:00:42 UTC, Johan Engelen wrote: Indeed. Please try to manually link first (without dub) by modifying the command on which dub errors:

Re: Checking if a structs .init value is zero bits only

2018-03-27 Thread Seb via Digitalmars-d-learn
On Wednesday, 28 March 2018 at 00:15:34 UTC, Per Nordlöw wrote: Is there a way to check if a struct `S` can be initialized using zero bits only, so that we can allocate and initialize an array of `S` in one go using `calloc`? If not, what should such a trait look like? Have a look at: https:

Re: "in" no longer "scope" since 2.079.0?

2018-03-27 Thread Seb via Digitalmars-d-learn
On Tuesday, 27 March 2018 at 11:24:01 UTC, Jonathan M Davis wrote: On Tuesday, March 27, 2018 09:58:11 bauss via Digitalmars-d-learn wrote: On Tuesday, 27 March 2018 at 09:27:07 UTC, Jonathan M Davis wrote: > [...] So now "in" is basically just an alias and serves no real purpose or is there

Re: Optional type - how to correctly reset a wrapped immutable T

2018-03-26 Thread Seb via Digitalmars-d-learn
On Monday, 26 March 2018 at 10:13:08 UTC, Simen Kjærås wrote: On Monday, 26 March 2018 at 09:46:57 UTC, Nicholas Wilson wrote: Have a look at Rebindable: https://dlang.org/phobos/std_typecons.html#rebindable Allow me to quote from aliak's post: what I'm looking for is a Rebindable implementat

Re: Homebuilt dmd fails to link my dub application

2018-03-26 Thread Seb via Digitalmars-d-learn
On Monday, 26 March 2018 at 10:01:38 UTC, Nordlöw wrote: On Sunday, 25 March 2018 at 20:35:01 UTC, Seb wrote: For building everything locally, it should be as easy as: --- git clone https://github.com/dlang/dmd git clone https://github.com/dlang/druntime git clone https://github.com/dlang/phobo

Re: The first example in the Learning D book, wont compile

2018-03-25 Thread Seb via Digitalmars-d-learn
On Sunday, 25 March 2018 at 20:45:58 UTC, Ali wrote: Hi The first example in the Learning D book import core.thread; import std.stdio; void main() { import std.range: iota, range; write("Greeting in, "); foreach(num; iota(1, 4).range) { writef("%s...", num); stdout.

Re: Homebuilt dmd fails to link my dub application

2018-03-25 Thread Seb via Digitalmars-d-learn
On Sunday, 25 March 2018 at 20:26:22 UTC, Nordlöw wrote: On Sunday, 25 March 2018 at 18:43:09 UTC, Seb wrote: Are you on a 32-bit system? (For 64-bit -fPIC is the default since 2.072.2 - though DMD's build scripts were only updated a few releases later) No, I have my own build script for dmd,

Re: dmd download sig file, how do I use it

2018-03-25 Thread Seb via Digitalmars-d-learn
On Sunday, 25 March 2018 at 14:13:41 UTC, Ali wrote: (Note: the individual keys in the keyring are currently expired and we are working on rolling out a new keyring, but that doesn't affect yverifying the existing signatures.) while you are at it, also add a sha1 or a sh256 checksum, i think

Re: Homebuilt dmd fails to link my dub application

2018-03-25 Thread Seb via Digitalmars-d-learn
On Sunday, 25 March 2018 at 12:05:32 UTC, Nordlöw wrote: If my homebuilt dmd fails to build my dub project with message /usr/bin/ld: error: .dub/build/application-unittest-linux.posix-x86_64-dmd_2079-C9019ECA621321CC168B385F53D82831/knetquery.o: requires dynamic R_X86_64_32 reloc against '_D6ob

Re: dmd download sig file, how do I use it

2018-03-24 Thread Seb via Digitalmars-d-learn
On Sunday, 25 March 2018 at 03:17:51 UTC, Ali wrote: Hi All, The DMD download is accompanied with a sig file How exactly do I use this sig file I am assuming I can use it in place of checksum to verify the download And to be honest, I have almost zero knowledge for gpg and encryption I googl

Re: Compile time initialization of AA

2018-03-23 Thread Seb via Digitalmars-d-learn
On Friday, 23 March 2018 at 22:43:47 UTC, Xavier Bigand wrote: I am trying to initialize an global immutable associative array of structs, but it doesn't compile. I am getting the following error message : "Error: not an associative array initializer". As I really need to store my data for a c

Re: Checking if a flag was passed to the compiler

2018-03-22 Thread Seb via Digitalmars-d-learn
On Thursday, 22 March 2018 at 12:02:40 UTC, Nicholas Wilson wrote: On Thursday, 22 March 2018 at 10:08:31 UTC, Nordlöw wrote: Is there a way to check in code whether a specific flag, -dip1000 in my case, was passed to the compiler? Most command line arguments that are detectable set a version,

Re: Manipulate slice or specific element of range and return range

2018-03-21 Thread Seb via Digitalmars-d-learn
On Wednesday, 21 March 2018 at 11:30:28 UTC, Timoses wrote: Hey, I'm struggling to find a way to achieve this. I've looked through std.algorithm but didn't find anything.. Maybe I'm blind. What I would like to do is filter out all spaces in a string and change the front letter to lower case

Re: Understanding slide

2018-03-21 Thread Seb via Digitalmars-d-learn
On Thursday, 22 March 2018 at 03:58:35 UTC, Seb wrote: On Thursday, 22 March 2018 at 03:39:38 UTC, Jordan Wilson wrote: auto a = iota(5).slide!(Yes.withPartial)(3); auto b = iota(5).slide!(No.withPartial)(3); assert (a.equal(b)); The assert passes, but I would expect it to fail? They both are:

Re: Understanding slide

2018-03-21 Thread Seb via Digitalmars-d-learn
On Thursday, 22 March 2018 at 03:39:38 UTC, Jordan Wilson wrote: auto a = iota(5).slide!(Yes.withPartial)(3); auto b = iota(5).slide!(No.withPartial)(3); assert (a.equal(b)); The assert passes, but I would expect it to fail? They both are: [[0,1,2],[1,2,3],[2,3,4]] Thanks, Jordan See: https:

Re: Does the compiler inline the predicate functions to std.algorithm.sort?

2018-03-19 Thread Seb via Digitalmars-d-learn
On Monday, 19 March 2018 at 12:45:58 UTC, tipdbmp wrote: (@tipdbmp: The string gets turned into the function _D3std10functional__T9binaryFunVAyaa5_61203c2062VQra1_61VQza1_62Z__TQBvTiTiZQCdFNaNbNiNfKiKiZb. No references to it remain with -O3; the LLVM IR obtained with -output-ll might be easier to

Re: Should the "front" range primitive be "const" ?

2018-03-19 Thread Seb via Digitalmars-d-learn
On Friday, 2 February 2018 at 14:29:34 UTC, H. S. Teoh wrote: On Fri, Feb 02, 2018 at 07:06:56AM +, Simen Kjærås via Digitalmars-d-learn wrote: [...] Its semantics are not broken; it's just harder to use. Due to const transitivity, it's an all-or-nothing deal. .tailConst gives us the mi

Re: Logging Function Parameters

2018-03-18 Thread Seb via Digitalmars-d-learn
On Saturday, 17 March 2018 at 10:34:41 UTC, dom wrote: Hi, I am looking for a method to log the current function name + parameters. Getting the name of the current function is simply possible with __PRETTY_FUNCTION__ Is there some possibility to generically access the parameters of a function

Re: How to build static linked executable

2018-03-17 Thread Seb via Digitalmars-d-learn
On Saturday, 17 March 2018 at 14:44:42 UTC, zunkree wrote: Hi, Is there a way to build static linked executable with dub for vibe-d based app? Regards, zunkree Yes, use -static Here's how we build the DTour: https://github.com/dlang-tour/core/blob/master/dub.sdl

Re: How to build static linked executable

2018-03-17 Thread Seb via Digitalmars-d-learn
On Saturday, 17 March 2018 at 15:42:06 UTC, Seb wrote: On Saturday, 17 March 2018 at 14:44:42 UTC, zunkree wrote: Hi, Is there a way to build static linked executable with dub for vibe-d based app? Regards, zunkree Yes, use -static Here's how we build the DTour: https://github.com/dlang-

Re: signbit question

2018-03-16 Thread Seb via Digitalmars-d-learn
On Friday, 16 March 2018 at 08:35:58 UTC, Radu wrote: On Friday, 16 March 2018 at 07:00:36 UTC, ashit axar wrote: On Thursday, 15 March 2018 at 17:30:48 UTC, Seb wrote: They generate the same assembly: https://godbolt.org/g/4ohTJx import std.stdio; void main() { writeln("hello"); } th

Re: signbit question

2018-03-15 Thread Seb via Digitalmars-d-learn
On Thursday, 15 March 2018 at 16:31:56 UTC, Stefan Koch wrote: On Thursday, 15 March 2018 at 15:28:16 UTC, Miguel L wrote: Why does std.math.signbit only work for floating point types? Is there an analogue function for integer types? what is the best way to compare the sign of a float with the

Re: signbit question

2018-03-15 Thread Seb via Digitalmars-d-learn
On Thursday, 15 March 2018 at 15:28:16 UTC, Miguel L wrote: Why does std.math.signbit only work for floating point types? Is there an analogue function for integer types? I guess because for integers you don't need to distinguish between +0.0 and -0.0, so no one bother until now to add it to

Re: Readonly field for class type

2018-03-15 Thread Seb via Digitalmars-d-learn
On Thursday, 15 March 2018 at 13:44:20 UTC, Seb wrote: On Thursday, 15 March 2018 at 10:57:52 UTC, Mike Parker wrote: On Thursday, 15 March 2018 at 10:55:16 UTC, Mike Parker wrote: class A { private int _value = 12; int value() @property { return _value; } void updateValue() { va

Re: Readonly field for class type

2018-03-15 Thread Seb via Digitalmars-d-learn
On Thursday, 15 March 2018 at 13:44:20 UTC, Seb wrote: On Thursday, 15 March 2018 at 10:57:52 UTC, Mike Parker wrote: On Thursday, 15 March 2018 at 10:55:16 UTC, Mike Parker wrote: [...] Sorry. I overlooked that B.a is const. It still works, the `value` just needs to be `const` (or `inout

Re: Readonly field for class type

2018-03-15 Thread Seb via Digitalmars-d-learn
On Thursday, 15 March 2018 at 10:57:52 UTC, Mike Parker wrote: On Thursday, 15 March 2018 at 10:55:16 UTC, Mike Parker wrote: class A { private int _value = 12; int value() @property { return _value; } void updateValue() { value = 13; } } ... auto a = new A(); writeln(a.value); a

Re: Networking library

2018-03-14 Thread Seb via Digitalmars-d-learn
On Thursday, 15 March 2018 at 00:10:28 UTC, Cecil Ward wrote: On Thursday, 15 March 2018 at 00:06:49 UTC, Cecil Ward wrote: Can anyone point me in the direction of a library that provides very very lightweight (minimum overhead) asynchronous i/o routines for - shopping list [...] Actually I

Re: Why does struct initializer works for arrays but not for associative arrays?

2018-03-14 Thread Seb via Digitalmars-d-learn
On Wednesday, 14 March 2018 at 15:17:54 UTC, Jonathan M Davis wrote: On Wednesday, March 14, 2018 13:36:51 Andre Pany via Digitalmars-d-learn wrote: [...] Well, I think that you have two issues here: 1. Struct literals work in only a few, specific circumstances. Why, I don't know, but IIRC,

Re: Why does file order matters when using -run option?

2018-03-14 Thread Seb via Digitalmars-d-learn
On Wednesday, 14 March 2018 at 14:44:24 UTC, Marc wrote: assume the files: app.d void main() { import myModule : foo; writeln(foo(...)); } myModule.d module myModule; int foo(int n) { } the following fail: dmd -run app.d mymodule.d give error like this: Error: module `myM

Re: how to make private class member private

2018-03-14 Thread Seb via Digitalmars-d-learn
On Wednesday, 14 March 2018 at 04:30:17 UTC, Amorphorious wrote: On Wednesday, 14 March 2018 at 01:41:33 UTC, psychoticRabbit wrote: On Tuesday, 13 March 2018 at 21:38:59 UTC, Amorphorious wrote: You are a moron...etc..etc..etc..etc. See. This is what happens when you have acces

Re: What's the proper way to add a local file dependence to dub?

2018-03-12 Thread Seb via Digitalmars-d-learn
On Sunday, 4 March 2018 at 16:46:56 UTC, Marc wrote: then copy it to sources folder? let's say I have a small library folder at C:\mylibrary\D where I want to use dir.d from it. How do I add that file dependence to dub? But I do not want to that file be passed directly to dmd, I want to that

Re: core.stdc.stdlib._compare_fp_t and qsort

2018-03-11 Thread Seb via Digitalmars-d-learn
On Sunday, 11 March 2018 at 23:12:30 UTC, Joe wrote: I'm getting a compiler error in a qsort() call as follows: qsort(recs, num_recs, (Record *).sizeof, compar); Record is a struct, recs is a fixed array of pointers to Record's and num_recs is a size_t that holds the number of valid recor

Re: Error compiling with DUB (dmd) since yesterday dub update

2018-03-11 Thread Seb via Digitalmars-d-learn
On Sunday, 11 March 2018 at 07:17:58 UTC, Mario wrote: On Sunday, 11 March 2018 at 07:11:09 UTC, rikki cattermole wrote: On 11/03/2018 8:02 PM, Mario wrote: On Sunday, 11 March 2018 at 06:59:32 UTC, rikki cattermole wrote: On 11/03/2018 7:55 PM, Mario wrote: [...] Are you aware that it is c

Re: Forwarding arguments through a std.algorithm.map

2018-03-11 Thread Seb via Digitalmars-d-learn
On Saturday, 10 March 2018 at 20:48:06 UTC, Nordlöw wrote: If I have a function bool f(Rs...)(Rs rs) is it somehow possible to map and forward all its arguments `rs` to another function bool g(Rs...)(Rs rs); through a call to some map-and-forward-like-function `forwardMap` in somet

Re: Slide - what does withPartial do?

2018-03-01 Thread Seb via Digitalmars-d-learn
On Thursday, 1 March 2018 at 08:31:05 UTC, Piotr Mitana wrote: For some reason this is true: slide!(Yes.withPartial)([1, 2, 3, 4, 5], 3).array == [[1, 2, 3], [2, 3, 4], [3, 4, 5]] Shouldn't it rather return [[1], [1, 2], [1, 2, 3], [2, 3, 4], [3, 4, 5], [4, 5], [5]], or at least [[1, 2, 3],

Re: Equivalent to Python with Statement

2018-02-28 Thread Seb via Digitalmars-d-learn
On Wednesday, 28 February 2018 at 21:47:40 UTC, Cym13 wrote: On Tuesday, 27 February 2018 at 16:17:20 UTC, Jonathan wrote: I know Python's `with` statement can be used to have an automatic close action: ``` with open("x.txt") as file: #do something with file #`file.close()` call

Re: Equivalent to Python with Statement

2018-02-27 Thread Seb via Digitalmars-d-learn
On Tuesday, 27 February 2018 at 16:18:43 UTC, Stefan Koch wrote: On Tuesday, 27 February 2018 at 16:17:20 UTC, Jonathan wrote: I know Python's `with` statement can be used to have an automatic close action: ``` with open("x.txt") as file: #do something with file #`file.close()`

Re: Searching string for character in binary search

2018-02-25 Thread Seb via Digitalmars-d-learn
On Sunday, 25 February 2018 at 21:18:55 UTC, Joel wrote: The number tests work, but not the string one. void main() { assert([1,2,3,4,5,6,7,8,9,10,11].binarySearch(6)); assert(! [1,2,3,4,5,7,8,9,10,11].binarySearch(6)); assert("abcdefghijklmnopqrstuvwxyz".binarySearch('j')); // not work

Re: iota to array

2018-02-24 Thread Seb via Digitalmars-d-learn
On Sunday, 25 February 2018 at 05:24:54 UTC, psychoticRabbit wrote: Hi. Anyone know whether something like this is possible? I've tried various conversions/casts, but no luck yet. Essentially, I want to cast the result set of the iota to an array, during initialisation of the variable. You c

Re: compilers w/ different language features: version block

2018-02-24 Thread Seb via Digitalmars-d-learn
On Sunday, 25 February 2018 at 01:19:02 UTC, Seb wrote: On Sunday, 25 February 2018 at 00:42:20 UTC, Seb wrote: On Sunday, 25 February 2018 at 00:36:16 UTC, kdevel wrote: [...] Are you looking for something like this? --- static if (__traits(compiles, () { static foreach (i; [0]){} }))

Re: countUntil to print all the index of a given string.

2018-02-24 Thread Seb via Digitalmars-d-learn
On Sunday, 25 February 2018 at 02:37:00 UTC, Jonathan M Davis wrote: If any exceptions could be thrown, then a lazy solution can't be @nogc (something that's often the case with strings thanks to auto-decoding and UTFExceptions), and a solution could be eager without allocating if the result do

Re: countUntil to print all the index of a given string.

2018-02-24 Thread Seb via Digitalmars-d-learn
On Tuesday, 20 February 2018 at 08:44:37 UTC, aberba wrote: On Sunday, 18 February 2018 at 15:23:14 UTC, Cym13 wrote: On Sunday, 18 February 2018 at 14:48:59 UTC, Cym13 wrote: [...] Just thought of a much better/simpler solution for that last case that also doesn't force you to read all data

Re: compilers w/ different language features: version block

2018-02-24 Thread Seb via Digitalmars-d-learn
On Sunday, 25 February 2018 at 00:42:20 UTC, Seb wrote: On Sunday, 25 February 2018 at 00:36:16 UTC, kdevel wrote: [...] Are you looking for something like this? --- static if (__traits(compiles, () { static foreach (i; [0]){} })) version = supportsStaticForeach; void main() { ver

Re: Vibe.d no more using static this() {}

2018-02-24 Thread Seb via Digitalmars-d-learn
On Friday, 23 February 2018 at 23:11:13 UTC, aberba wrote: I recently noticed vibe.d now using main loop which call the vibe.d event loop. "Recently"? FWIW this has been phased out a long time ago ;-) --- 0.7.23 (2015) Definition of either VibeCustomMain or VibeDefaultMain is now a hard req

Re: compilers w/ different language features: version block

2018-02-24 Thread Seb via Digitalmars-d-learn
On Sunday, 25 February 2018 at 00:36:16 UTC, kdevel wrote: A code fragment using static foreach https://forum.dlang.org/thread/jiefcxwqbjzqnmtaz...@forum.dlang.org#post-beruryblsptnunsowjph:40forum.dlang.org does not compile with the current GDC (GCC 4.9.4 and 5.5.0). I tried to encapsulate th

Re: How to split a string to a 2D array

2018-02-24 Thread Seb via Digitalmars-d-learn
On Saturday, 24 February 2018 at 09:06:09 UTC, Domain wrote: On Saturday, 24 February 2018 at 08:59:46 UTC, Domain wrote: On Saturday, 24 February 2018 at 07:51:27 UTC, Domain wrote: [...] And why this not compile: rows.each!(a => data ~= a.split(",").map!(b => b.strip).padRight("", 2));

Re: Understanding the AST...

2018-02-22 Thread Seb via Digitalmars-d-learn
On Tuesday, 6 February 2018 at 12:03:06 UTC, joe wrote: Hello everybody! Last week end I found this post ( https://dlang.org/blog/2017/08/01/a-dub-case-study-compiling-dmd-as-a-library/ ) on the Blog and thought to myself awesome. [...] BTW I know it's not as powerful as DMD (and not the r

Re: Link to https://run.dlang.io/ ??

2018-02-20 Thread Seb via Digitalmars-d-learn
On Tuesday, 20 February 2018 at 14:45:55 UTC, Dennis wrote: I recently tried to go to that site, and I tried `run.dlang.com` which is the wrong URL. So I was looking through the D homepage for the right link but couldn't find it. Even a Google search for "online d compiler" or "run dlang onlin

Re: Building from source on FreeBSD

2018-02-19 Thread Seb via Digitalmars-d-learn
On Monday, 19 February 2018 at 12:01:31 UTC, Jonathan M Davis wrote: On Monday, February 19, 2018 11:43:26 psychoticRabbit via Digitalmars-d- learn wrote: [...] I've never been able to figure this problem out, so I've I always just edited the makefile so that the two programs in CURL_TOOLS a

Re: std.array.array for immutable data types

2018-02-18 Thread Seb via Digitalmars-d-learn
On Monday, 19 February 2018 at 07:08:49 UTC, Fra Mecca wrote: Is there a way to avoid using to! conversion here? immutable string[] dst = to!(immutable string[])(array(pipe.readEnd.byLineCopy)); Are you looking for something like assumeUnique [1]? ``` pipe.readEnd.byLineCopy.array.assumeUniq

Re: Access visibility and linkage

2018-02-14 Thread Seb via Digitalmars-d-learn
On Thursday, 15 February 2018 at 06:43:52 UTC, Arun Chandrasekaran wrote: I was reading through https://wiki.dlang.org/Access_specifiers_and_visibility#What_is_missing [...] DMD v2.077.1 exhibits the same behavior. Is this is already being worked on? Or is there any plan to address this? Ca

Re: vib.d suppress 404 for no content written

2018-02-14 Thread Seb via Digitalmars-d-learn
On Wednesday, 14 February 2018 at 21:16:23 UTC, aberba wrote: Seb, are you the one doing the vibe.d demo collections? Do you mean this? https://github.com/wilzbach/vibe-d-by-example Yes, that's me, but it still needs a lot of work and I haven't got around polishing it for an alpha "release"

Re: vib.d suppress 404 for no content written

2018-02-14 Thread Seb via Digitalmars-d-learn
On Wednesday, 14 February 2018 at 14:30:19 UTC, Nicholas Wilson wrote: I have an endpoint that is a post: void postStuff(HTTPServerRequest req, HTTPServerResponse res) { // do some stuff with req res.statusCode = 200; } I do not write anything to res (deliberately) but want to set the

Re: rmdirRecurse - on NFS file system

2018-02-13 Thread Seb via Digitalmars-d-learn
On Tuesday, 13 February 2018 at 16:58:09 UTC, Vino wrote: On Monday, 12 February 2018 at 06:52:25 UTC, Vino wrote: [...] Hi All, Was able to resolve this issue. That's great! BTW I think it would be helpful for future reader who find this thread to know how you resolved your problem.

Re: import strangeness with std.stdio.write

2018-02-13 Thread Seb via Digitalmars-d-learn
On Tuesday, 13 February 2018 at 16:55:10 UTC, ixid wrote: On Tuesday, 13 February 2018 at 13:52:37 UTC, rikki cattermole wrote: write exists in both, writeln exists only in std.stdio. Use named imports to pick which write you want. It does seem a little silly to have a name clash with such a

Re: What should I use for concat string into array in loop?

2018-02-12 Thread Seb via Digitalmars-d-learn
On Tuesday, 13 February 2018 at 01:56:45 UTC, H. S. Teoh wrote: On Tue, Feb 13, 2018 at 01:58:42AM +, Marc via Digitalmars-d-learn wrote: appender doesn't support string[] so in such case: Why not? This seems to work: import std.array; import std.stdio; void main()

Re: dmd-2.078.2 problems with Ubuntu 17.10 32Bit

2018-02-12 Thread Seb via Digitalmars-d-learn
On Monday, 12 February 2018 at 20:56:11 UTC, Martin Tschierschke wrote: I just started to play around with D again on my notebook at home and realized, that I have a broken installation. Even the minimal D "hello world" throws an error at execution. Speicherzugriffsfehler (Speicherabzug geschrie

Re: How does this error from dub mean "dlang Non-selected Y package is available with version X"?

2018-02-12 Thread Seb via Digitalmars-d-learn
On Monday, 12 February 2018 at 15:51:58 UTC, Marc wrote: the warning is: Non-selected package lnk is available with version ~>0.2.1. What does it mean by *Non-selected* package lnk is available? from what I could tell from the page, it's highest version. But I've tried low versions anyway to

Re: Caesar Cipher

2018-02-11 Thread Seb via Digitalmars-d-learn
On Sunday, 11 February 2018 at 18:50:25 UTC, Mario wrote: On Sunday, 11 February 2018 at 18:31:35 UTC, Seb wrote: On Sunday, 11 February 2018 at 18:01:20 UTC, Mario wrote: Hello there! I know deep Java, JavaScript, PHP, etc. but as you all probably know, that's high-level and most of them only

Re: Caesar Cipher

2018-02-11 Thread Seb via Digitalmars-d-learn
On Sunday, 11 February 2018 at 18:01:20 UTC, Mario wrote: Hello there! I know deep Java, JavaScript, PHP, etc. but as you all probably know, that's high-level and most of them only use the heap memory. [...] If you want to cheap, have a look at https://github.com/dlang-tour/core/issues/227

Re: Fixed size array initialization

2018-02-10 Thread Seb via Digitalmars-d-learn
On Saturday, 10 February 2018 at 15:54:03 UTC, rumbu wrote: On Saturday, 10 February 2018 at 14:55:49 UTC, b2.temp wrote: On Saturday, 10 February 2018 at 14:35:52 UTC, rumbu wrote: In this case, it there any way to be sure that I declared all the elements I intended? Obviously, without count

Re: Debugging bad requests with vibe

2018-02-09 Thread Seb via Digitalmars-d-learn
On Thursday, 8 February 2018 at 17:09:44 UTC, Nicholas Wilson wrote: Is there a way I can see/log what requests are being made? I can change both the client and server. -v and -vv

Re: are scope guards (scope(exit, success, failure)) zero-cost abstractions?

2018-02-08 Thread Seb via Digitalmars-d-learn
On Thursday, 8 February 2018 at 11:23:43 UTC, Daniel Kozak wrote: I mean scope(success), for scope(exit) there is no speed penalty On Thu, Feb 8, 2018 at 12:03 PM, Daniel Kozak wrote: Yes, it add, but is almost zero On Thu, Feb 8, 2018 at 12:00 PM, Timothee Cour via Digitalmars-d-learn <

Re: are scope guards (scope(exit, success, failure)) zero-cost abstractions?

2018-02-08 Thread Seb via Digitalmars-d-learn
On Thursday, 8 February 2018 at 10:44:37 UTC, Mike Parker wrote: On Thursday, 8 February 2018 at 10:09:12 UTC, Timothee Cour wrote: I'm curious whether scope guards add any cost over the naive way, eg: ``` void fun(){ ... scope(success) {bar;} ... } ``` vs: ``` void fun(){ ... if(f

Re: Vibe.d rest & web service?

2018-02-07 Thread Seb via Digitalmars-d-learn
On Wednesday, 7 February 2018 at 17:04:13 UTC, Nicholas Wilson wrote: Is it possible to have some urls routed to serve content and some to receive JSON in the same class? Basically I want: shared static this() { auto router = new URLRouter; auto a = new MyInterface; router.registerW

Re: extern(C++) in win32.mak

2018-02-07 Thread Seb via Digitalmars-d-learn
On Wednesday, 7 February 2018 at 14:38:37 UTC, Jacob Carlborg wrote: On 2018-02-07 14:47, Paul D Anderson wrote: I get Error: 'of..\generated\windows\release\32\lexer.lib' not found I don't think this file is built anymore. It's a leftover of the lexer experiment and AFAICT still built: ht

Re: extern(C++) in win32.mak

2018-02-07 Thread Seb via Digitalmars-d-learn
On Wednesday, 7 February 2018 at 06:05:54 UTC, Paul D Anderson wrote: I don't understand the following line in dmd/src/win32.mak: extern (C++) __gshared const(char)* ddoc_default = import ("default_ddoc_theme.ddoc"); What does the word "import" mean in this context? I can't find any document

Re: enumerated iteration to struct

2018-02-06 Thread Seb via Digitalmars-d-learn
On Wednesday, 7 February 2018 at 01:45:27 UTC, Jonathan M Davis wrote: Perhaps, but foreach does not support that. foreach(e; range) { ... } is lowered to something like for(auto __range = range; !__range.empty; __range.popFront()) { auto e = __range.front; ... } Fun fact: an ac

Re: Using file as input to stdin when compiling

2018-02-06 Thread Seb via Digitalmars-d-learn
On Tuesday, 6 February 2018 at 06:10:30 UTC, Jamie wrote: Hi, I'm following through TDPL and am trying to import a txt file during compiling for the stdin.byLine() function to read. Currently I have #!/usr/bin/rdmd and would like it to analyse the supplied text file. Is this possible in the w

Re: How to convert hex string to string or ubytes? Thanks.

2018-02-05 Thread Seb via Digitalmars-d-learn
On Monday, 5 February 2018 at 08:41:43 UTC, FrankLike wrote: On Monday, 5 February 2018 at 06:12:22 UTC, H. S. Teoh wrote: On Mon, Feb 05, 2018 at 05:48:00AM +, FrankLike via auto input = "48656c6c6f20776f726c6421"; auto str = input.chunks(2) .map!(digits

Re: Setting up DMD on windows

2018-02-04 Thread Seb via Digitalmars-d-learn
On Sunday, 4 February 2018 at 17:11:21 UTC, Rubn wrote: On Sunday, 4 February 2018 at 01:33:05 UTC, Seb wrote: On Sunday, 4 February 2018 at 01:23:50 UTC, Rubn wrote: On Saturday, 3 February 2018 at 23:42:28 UTC, welkam wrote: [...] I think you have to build with an old version of MSVC, 2010

Re: Interfacing with C++

2018-02-04 Thread Seb via Digitalmars-d-learn
On Sunday, 4 February 2018 at 10:42:22 UTC, infinityplusb wrote: On Sunday, 4 February 2018 at 08:33:20 UTC, Mike Parker wrote: [...] it is, everyone keeps saying writing bindings in D is super easy ... I feel this is a slight simplification. :( [...] Sounds easy enough. [...] [...] T

Re: Setting up DMD on windows

2018-02-03 Thread Seb via Digitalmars-d-learn
On Sunday, 4 February 2018 at 01:23:50 UTC, Rubn wrote: On Saturday, 3 February 2018 at 23:42:28 UTC, welkam wrote: [...] I think you have to build with an old version of MSVC, 2010 maybe? It's been a while since I built it I don't remember the exactly which version ended up working. 2013

Re: Adjacent item in a array

2018-02-03 Thread Seb via Digitalmars-d-learn
On Saturday, 3 February 2018 at 19:13:05 UTC, Vino wrote: Hi All, Request you help on printing an array in below, Eg: Array ("T1", "T2", "T3", "T4", "T5") Output required as below T1,T2 T2,T3 T3,T4 T4,T5 From, Vino.B 2.079 [1, 2] will ship with slide: --- auto arr = ["T1", "T2", "T3",

Re: select, poll, epoll from D

2018-02-02 Thread Seb via Digitalmars-d-learn
On Friday, 2 February 2018 at 18:00:45 UTC, Russel Winder wrote: Hi, Has anyone got any examples of using (select|poll|epoll) directly from D. Yes I can work it out from first principles, but it would be great to see what others have done in the past so as to make use of their work. Do you

<    1   2   3   4   >