Re: Comping a Musl-linked druntime & phobos?

2022-08-25 Thread TheGag96 via Digitalmars-d-learn
On Thursday, 25 August 2022 at 01:52:15 UTC, Mathias LANG wrote: (snip) Hmmm... Maybe I don't understand. What exactly *is* Alpine Linux doing? That .patch file didn't contain anything substantial. It looks like it has some version of LDC on hand to use, probably already set up properly to

Comping a Musl-linked druntime & phobos?

2022-08-24 Thread TheGag96 via Digitalmars-d-learn
Hi, all. Has anyone had any success compiling a Musl-linked druntime and phobos? I haven't had any luck so far. I'm running Linux Mint x64. Somewhat related - using `-target=x86_64-linux-musl` with dmd master doesn't even set the version `CRuntime_Musl`. I asked about this in the Discord,

Re: dlang vs crystal-language

2021-04-30 Thread TheGag96 via Digitalmars-d-learn
On Friday, 30 April 2021 at 14:16:16 UTC, Vinod K Chandran wrote: On Wednesday, 28 April 2021 at 22:41:03 UTC, Alain De Vos wrote: What are the strengths and weaknesses comparing the two languages ? I can name a strength of dlang is the working binding to tk and gtk. Pros of **Crystal** 1.

Re: What kind of Editor, IDE you are using and which one do you like for D language?

2019-12-23 Thread TheGag96 via Digitalmars-d-learn
On Sunday, 22 December 2019 at 17:20:51 UTC, BoQsc wrote: There are lots of editors/IDE's that support D language: https://wiki.dlang.org/Editors What kind of editor/IDE are you using and which one do you like the most? I've loved Sublime for years. I use it for everything, really. So

Details of the inline import idiom

2019-09-26 Thread TheGag96 via Digitalmars-d-learn
I was looking back at the inline import idiom article[1]. One of the purported benefits of doing something like from!"std.datetime".SysTime was that doing so wouldn't go and import the entirety of the module into the namespace and slow down compile time / bloat the binary. But how is this so?

Is DWT busted?

2018-06-07 Thread TheGag96 via Digitalmars-d-learn
I'm sorry about bringing this into here instead of DWT's subforum, but it's somewhat dead and hasn't been getting a lot of attention. I decided to finally play around with DWT today and tried to build the example. I got this: Performing "debug" build using /usr/bin/dmd for x86_64. dwt:base

Re: Dealing with the interior pointers bug

2017-06-21 Thread TheGag96 via Digitalmars-d-learn
On Wednesday, 21 June 2017 at 15:42:22 UTC, Adam D. Ruppe wrote: This comes from the fact that D's GC is conservative - if it sees something that *might* be a pointer, it assumes it *is* a pointer and thus had better not get freed. So is the GC then simply made to be "better-safe-than-sorry"

Dealing with the interior pointers bug

2017-06-21 Thread TheGag96 via Digitalmars-d-learn
I saw this Tip of the Week a while ago (http://arsdnet.net/this-week-in-d/2017-mar-12.html) and was kind of perplexed at it. It seems like a crazy potential bug... How exactly is the GC implemented that causes this problem to crop up? Does the GC just blindly scan memory until it finds

Re: Porting Java code to D that uses << and >>> operators

2017-05-02 Thread TheGag96 via Digitalmars-d-learn
On Tuesday, 2 May 2017 at 07:42:45 UTC, Jacob Carlborg wrote: From that link: "Note that dmd currently does not comply with left to right evaluation of function arguments and AssignExpression". This is something I've never understood. Why doesn't DMD implement the behavior their own

Re: BinaryHeap crashes upon insertion if heapified with an array of length 1?

2017-04-10 Thread TheGag96 via Digitalmars-d-learn
On Sunday, 9 April 2017 at 13:31:05 UTC, Michael Coulombe wrote: This is a bug in the insert method. I created a bug report for you and submitted a pull request for a fix: https://issues.dlang.org/show_bug.cgi?id=17314 Ah, so it is. Thanks!!

BinaryHeap crashes upon insertion if heapified with an array of length 1?

2017-04-08 Thread TheGag96 via Digitalmars-d-learn
I'm trying to use a binary heap initialized with one element. However, this always seems to cause a range violation for some reason. This small example will do it: import std.stdio, std.container; void main() { auto pq = heapify([5]); pq.insert(8); } ...And it produces this error:

Re: Policy-based design in D

2017-02-14 Thread TheGag96 via Digitalmars-d-learn
On Tuesday, 14 February 2017 at 10:05:19 UTC, TheFlyingFiddle wrote: (snip) Oh, I didn't know you could name mixin template instantiations like that! Thanks for the tip, that makes things work nicely!

Policy-based design in D

2017-02-13 Thread TheGag96 via Digitalmars-d-learn
Tonight I stumbled upon Andrei's concept of policy-based design (https://en.wikipedia.org/wiki/Policy-based_design) and tried to implement their example in D with the lack of multiple inheritance in mind. https://dpaste.dzfl.pl/adc05892344f (btw, any reason why certificate validation on

Re: Strange memory corruption / codegen bug?

2016-12-11 Thread TheGag96 via Digitalmars-d-learn
On Sunday, 11 December 2016 at 11:58:39 UTC, ag0aep6g wrote: Try putting an `assert(childCrossPoint !is otherCrossPoint);` before the assignment. If it fails, the variables refer to the same node. That would explain how otherCrossPoint.left gets set. Ahh... This led me to it. I was about to

Re: Strange memory corruption / codegen bug?

2016-12-11 Thread TheGag96 via Digitalmars-d-learn
On Sunday, 11 December 2016 at 11:17:50 UTC, rikki cattermole wrote: Not public, please pastebin. https://github.com/TheGag96/evo-pacman/blob/master/source/pacman/tree.d#L135 I just put it on GitHub. No idea why the repo wasn't public even after I set it to be public...

Strange memory corruption / codegen bug?

2016-12-11 Thread TheGag96 via Digitalmars-d-learn
I was porting my Evolutionary Computing homework written in Python over to D, and I've come across this bug I cannot for the life of me figure out. https://gitlab.com/TheGag96/evo-pacman/blob/master/source/pacman/tree.d#L139 I don't think I could cut this down to a smaller reproducible

Re: A simplification of the RvalueRef idiom

2016-11-23 Thread TheGag96 via Digitalmars-d-learn
On Tuesday, 22 November 2016 at 13:06:27 UTC, Nordlöw wrote: On Monday, 21 November 2016 at 20:04:51 UTC, Ali Çehreli wrote: mixin template RvalueRef()// <-- DOES NOT TAKE A PARAMETER ANY MORE { alias T = typeof(this); static assert (is(T == struct)); @nogc @safe ref

Re: strange -fPIC compilation error

2016-11-01 Thread TheGag96 via Digitalmars-d-learn
On Monday, 31 October 2016 at 07:16:50 UTC, Sebastien Alaiwan wrote: Hello, From GCC 6.2, -fpie is becoming the default setting at compile and at link time. As dmd uses GCC to link, now the code needs to be compiled with a special option. Which means you need, at the moment, to add the

Re: Why can't static arrays be sorted?

2016-10-10 Thread TheGag96 via Digitalmars-d-learn
On Saturday, 8 October 2016 at 21:14:43 UTC, Jon Degenhardt wrote: This distinction is a bit on the nuanced side. Is it behaving as it should? --Jon I think so? It's not being modified in the second case because the array is being passed by value... "x" there is a reference to an element

Re: Why can't static arrays be sorted?

2016-10-06 Thread TheGag96 via Digitalmars-d-learn
On Wednesday, 5 October 2016 at 19:30:01 UTC, Jonathan M Davis wrote: It doesn't even make conceptual sense for a static array to be a range, because you can't remove elements from it. - Jonathan M Davis Interestingly enough, I found that using .each() actually compiles without the [] but

Re: Why can't static arrays be sorted?

2016-10-05 Thread TheGag96 via Digitalmars-d-learn
On Wednesday, 5 October 2016 at 02:19:13 UTC, Jonathan M Davis wrote: The problem is that static arrays aren't ranges (calling popFront on them can't work, because their length isn't mutable). However, you can slice a static array to get a dynamic array which _is_ a range. e.g.

Why can't static arrays be sorted?

2016-10-04 Thread TheGag96 via Digitalmars-d-learn
I was writing some code today and ran into this oddity that I'd never come across before: import std.algorithm : sort; int[10] arr = [0, 3, 4, 6, 2, 1, 1, 4, 6, 9]; thing.sort(); This doesn't compile. Obviously the .sort property works, but what about static arrays makes them

Re: Can't use std.algorithm.remove on a char[]?

2016-05-01 Thread TheGag96 via Digitalmars-d-learn
On Sunday, 1 May 2016 at 09:11:22 UTC, ag0aep6g wrote: It's because of auto-decoding. char[] is an array of chars, but it's been made a range of dchars. Calling front on a char[] decodes up to four chars into one dchar. Obviously you can't take the address of the dchar, because it's just a

Re: Can't use std.algorithm.remove on a char[]?

2016-04-30 Thread TheGag96 via Digitalmars-d-learn
On Saturday, 30 April 2016 at 19:21:30 UTC, ag0aep6g wrote: On 30.04.2016 21:08, Jon D wrote: If an initial step is to fix the documentation, it would be helpful to include specifically that it doesn't work with characters. It's not obvious that characters don't meet the requirement.

Can't use std.algorithm.remove on a char[]?

2016-04-30 Thread TheGag96 via Digitalmars-d-learn
I was just writing some code trying to remove a value from a character array, but the compiler complained "No overload matches for remove", and if I specifically say use std.algorithm.remove() the compiler doesn't think it fits any definition. For reference, this would be all I'm doing:

Re: D and devkitARM

2016-03-10 Thread TheGag96 via Digitalmars-d-learn
On Thursday, 10 March 2016 at 14:36:26 UTC, Nicholas Wilson wrote: Hmm. I apologise that this post is not in any logical order. dmd can only compile for x86 so you will have to use ldc or gdc makefiles are generally not used in d. you should be able to use the dub project settings file

D and devkitARM

2016-03-08 Thread TheGag96 via Digitalmars-d-learn
Hi guys, for a possibly-in-over-my-head project I'd like to get working a simple "Hello World" type program in which I call a D function from C in a 3DS homebrew app (or maybe even have it all in plain D with bindings to libctru). The thing is, I'm not skilled with Makefiles so I don't have a

TreeViews in tkd

2015-12-17 Thread TheGag96 via Digitalmars-d-learn
I've been trying to get into tkd to make some GUI apps, since it looked like the simplest/intuitive library out there so far. I've been attempting to use their TreeViews to make interactable lists of things, but it almost looks like there's some missing functionality. For example, I'm not

Re: TreeViews in tkd

2015-12-17 Thread TheGag96 via Digitalmars-d-learn
On Thursday, 17 December 2015 at 11:33:31 UTC, Gary Willoughby wrote: On Thursday, 17 December 2015 at 09:47:42 UTC, TheGag96 wrote: I've been trying to get into tkd to make some GUI apps, since it looked like the simplest/intuitive library out there so far. I've been attempting to use their

Re: conver BigInt to string

2015-11-05 Thread TheGag96 via Digitalmars-d-learn
On Thursday, 5 November 2015 at 16:45:10 UTC, Meta wrote: The second issue is that using .sort instead of .sort() (note the parentheses) calls the built-in sort instead of std.algorithm.sort, which is strongly discouraged. You should always use std.algorithm.sort over the built-in sort, which

Re: Array of BitArrays definition compiles in DMD but not in GDC.

2015-10-09 Thread TheGag96 via Digitalmars-d-learn
On Friday, 9 October 2015 at 07:08:15 UTC, John Colvin wrote: On Thursday, 8 October 2015 at 21:40:02 UTC, TheGag96 wrote: [...] gdc is a bit out of date at the moment. If you do something like this: auto bitArray(bool[] ba) pure nothrow { BitArray tmp; tmp.init(ba); return

Array of BitArrays definition compiles in DMD but not in GDC.

2015-10-08 Thread TheGag96 via Digitalmars-d-learn
In my code I'm passing an array of BitArrays to a constructor like this (though mostly as a placeholder): Terrain t = new Terrain(1, 15, [ BitArray([1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]), BitArray([1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1]), BitArray([0, 0, 1, 1, 1, 0, 1, 1, 1, 1,

I can't get passing an array by reference to work anymore...

2015-09-24 Thread TheGag96 via Digitalmars-d-learn
So I'm just doing a small test program here: http://pastebin.com/UYf2n6bP (I'm making sure I know quicksort for my algorithms class, I know functionally this won't work as-is) I'm on Linux, 64-bit, DMD 2.068.1, and when I try to compile this I'm getting: quicksort.d(18): Error: function

Re: Example from d-idioms is incorrect

2015-04-30 Thread TheGag96 via Digitalmars-d-learn
On Thursday, 30 April 2015 at 22:01:43 UTC, Justin Whear wrote: On Thu, 30 Apr 2015 21:30:34 +, TheGag96 wrote: Was the behavior of the remove() function changed recently? Thanks guys. I believe remove has always worked this way. What you're seeing is explained by this note in the

Example from d-idioms is incorrect

2015-04-30 Thread TheGag96 via Digitalmars-d-learn
I was looking at the d-idioms website today and saw this code example: http://p0nce.github.io/d-idioms/#Adding-or-removing-an-element-from-arrays And I was kind of irked. I just recently working with removing an element from an array in a small project I worked on two weeks ago, and I had to

Re: Reading whitespace separated strings from stdin?

2015-04-22 Thread TheGag96 via Digitalmars-d-learn
On Tuesday, 21 April 2015 at 03:44:16 UTC, weaselcat wrote: snip Wow, that's a damn good solution... I didn't know that readln() could take an argument that it stops at once it finds. Now the thing is, this program is supposed to be a reverse Polish notation calculator. A human using this

Reading whitespace separated strings from stdin?

2015-04-20 Thread TheGag96 via Digitalmars-d-learn
Hi guys! I had this homework assignment for data structures that has a pretty easy solution in C++. Reading input like this... 1 2 3 # $ 4 3 * ! # 20 3 / # $ # 62 # $ 2 3 8 * + # 4 48 4 2 + / # SUM # $ 1 2 3 4 5 # R # @ ...where @ denotes the end of input is fairly simple in C++: string token

Re: Reading whitespace separated strings from stdin?

2015-04-20 Thread TheGag96 via Digitalmars-d-learn
On Tuesday, 21 April 2015 at 01:46:53 UTC, Adam D. Ruppe wrote: I think this should work: import std.stdio; void main() { string token; while(readf(%s , token)) writeln(token); } Have you tried that? What is wrong with it if you have? It'll just leave some

Linking C++ standard library works with GDC... but not DMD. (Linux)

2015-04-16 Thread TheGag96 via Digitalmars-d-learn
Hi, I've got this project that requires me to link into a C++ backend. It works just fine when using GDC: gdc *.d [client libraries] However, this command using DMD does not work: dmd -L-lstdc++ *.d [client libraries] I still get errors involving the standard library not being added like:

Re: Linking C++ standard library works with GDC... but not DMD. (Linux)

2015-04-16 Thread TheGag96 via Digitalmars-d-learn
On Thursday, 16 April 2015 at 09:46:40 UTC, John Colvin wrote: On Thursday, 16 April 2015 at 08:51:15 UTC, TheGag96 wrote: Hi, I've got this project that requires me to link into a C++ backend. It works just fine when using GDC: gdc *.d [client libraries] However, this command using DMD does

Re: Linking C++ standard library works with GDC... but not DMD. (Linux)

2015-04-16 Thread TheGag96 via Digitalmars-d-learn
On Thursday, 16 April 2015 at 12:57:12 UTC, Steven Schveighoffer wrote: /usr/include/c++/4.8/iostream:74: undefine reference to `std::ios_base::Init::Init()' (etc.) Try dmd -v to tell you exactly what command it is running for link. Then play around with the link line to see if you can