Re: Mixin helper help
On 1/13/23 18:51, bauss wrote: That's a good one! It looks like you liked it four years ago as well. :) I found where I remembered it from: https://forum.dlang.org/post/pvdoq2$1e7t$3...@digitalmars.com Ali
Re: Why not allow elementwise operations on tuples?
On Friday, 13 January 2023 at 15:27:26 UTC, H. S. Teoh wrote: On Fri, Jan 13, 2023 at 02:22:34PM +, Sergei Nosov via Digitalmars-d-learn wrote: Hey, everyone! I was wondering if there's a strong reason behind not implementing elementwise operations on tuples? Say, I've decided to store 2d points in a `Tuple!(int, int)`. It would be convenient to just write `a + b` to yield another `Tuple!(int, int)`. I've written a Vec type that implements precisely this, using tuples behind the scenes as the implementation, and operator overloading to allow nice syntax for vector arithmetic. Yeah, that's clear that such an implementation is rather straightforward. Although, I'm a bit confused with your implementation - 1. it doesn't seem to use tuples behind the scenes despite your claim (it uses static array) 2. `alias impl this;` introduces some unexpected interactions (e.g. `~` and `toString` are "intercepted" by the array implementation and yield "wrong" results). Anyway, my original question was primarily about reasoning - why there's no implementation specifically for `std.Tuple`? If it's a "feature, not a bug" - what's the best way to provide an implementation on the client side?
Re: Mixin helper help
On Monday, 16 January 2023 at 08:17:24 UTC, Ali Çehreli wrote: On 1/13/23 18:51, bauss wrote: That's a good one! It looks like you liked it four years ago as well. :) I found where I remembered it from: https://forum.dlang.org/post/pvdoq2$1e7t$3...@digitalmars.com Ali Looks like my memory isn't as good, as I had totally forgotten about it, but perhaps because I haven't gotten to use it :)
MacOS Weirdness
I just fixed a bug in my personal D hobby project. After pushing everything to github, I noticed that it fails to link with the latest LDC on MacOS. The error I'm getting is thus: ``` ld: warning: alignment (1) of atom 'anon' is too small and may result in unaligned pointers ld: warning: pointer not aligned at address 0x3D2C9 ('anon' + 4809 from .dub/build/shared-debug-posix.osx.darwin-x86_64-ldc_v1.30.0-8F420C7727F3804A85668CA76BD80D4C//obj/libdutils.o) ld: unaligned pointer(s) for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation) Error: /usr/bin/cc failed with status: 1 FAIL .dub/build/shared-debug-posix.osx.darwin-x86_64-ldc_v1.30.0-8F420C7727F3804A85668CA76BD80D4C/ dutils dynamicLibrary /Users/runner/hostedtoolcache/dc/ldc2-1.30.0/x64/ldc2-1.30.0-osx-universal/bin/ldc2 failed with exit code 1. ``` This only happens when building the project as a shared library. It builds perfectly fine as a static library. Any solutions? Thanks in advance.
Re: MacOS Weirdness
On Tuesday, 17 January 2023 at 03:48:03 UTC, Ruby The Roobster wrote: I just fixed a bug in my personal D hobby project. After pushing everything to github, I noticed that it fails to link with the latest LDC on MacOS. The error I'm getting is thus: ``` ld: warning: alignment (1) of atom 'anon' is too small and may result in unaligned pointers ld: warning: pointer not aligned at address 0x3D2C9 ('anon' + 4809 from .dub/build/shared-debug-posix.osx.darwin-x86_64-ldc_v1.30.0-8F420C7727F3804A85668CA76BD80D4C//obj/libdutils.o) ld: unaligned pointer(s) for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation) Error: /usr/bin/cc failed with status: 1 FAIL .dub/build/shared-debug-posix.osx.darwin-x86_64-ldc_v1.30.0-8F420C7727F3804A85668CA76BD80D4C/ dutils dynamicLibrary /Users/runner/hostedtoolcache/dc/ldc2-1.30.0/x64/ldc2-1.30.0-osx-universal/bin/ldc2 failed with exit code 1. ``` This only happens when building the project as a shared library. It builds perfectly fine as a static library. Any solutions? Thanks in advance. This is a known issue: https://github.com/ldc-developers/ldc/issues/3864 Will be fixed in LDC 1.31. https://github.com/ldc-developers/ldc/pull/4291 -Johan