This program does not compile.
Error: cannot implicitly convert expression (cast(int)x -
cast(int)x) of type int to ubyte
void main(){
ubyte x;
x = x - x;
}
I don't even know what to say. Who thought this behavior was a
good idea?
On Wednesday, 7 September 2016 at 20:29:42 UTC, jmh530 wrote:
Thanks for the reply. It looks like an interesting idea. You
might consider adding this (or a modified version) to a read me
in the range subfolder.
Fuck it, I took an hour to document the most significant modules.
On Wednesday, 31 August 2016 at 07:40:39 UTC, Dorian Haglund
wrote:
Hello,
I have an array of objects of class C which contain a id member.
I want to figure out if all the id members are unique using
functional primitives.
For example, if I have:
class C
{
int id;
}
and an array of C
On Wednesday, 31 August 2016 at 14:03:20 UTC, Yuxuan Shui wrote:
I want to make a hash table that uses std.experiment.allocator.
The bucket is allocated from an allocator, and freed in
~this(). I don't want to copy the whole bucket in this(this).
Maybe I should use a reference counter or
On Friday, 9 September 2016 at 11:54:42 UTC, Steven Schveighoffer
wrote:
Can you demonstrate the issue? I have never heard of this.
imports should work when done inside a function.
-Steve
Tried and failed to reproduce with a simple example, but any time
I've tried doing it in the code I'm
I've got a struct and it would be very convenient if I could
specify what happens when I write `if(value)` - is this possible?
On Saturday, 10 September 2016 at 14:24:23 UTC, ag0aep6g wrote:
On 09/10/2016 04:10 PM, pineapple wrote:
I've got a struct and it would be very convenient if I could
specify
what happens when I write `if(value)` - is this possible?
`if (value)` implies a cast to bool. Define opCast!bool and
On Friday, 9 September 2016 at 09:43:15 UTC, O-N-S wrote:
On Friday, 9 September 2016 at 09:31:54 UTC, pineapple wrote:
On Friday, 9 September 2016 at 08:25:40 UTC, rikki cattermole
wrote:
TLDR: no you cannot do what you were thinking.
Seems like something one ought to be able to do, though.
On Friday, 9 September 2016 at 08:25:40 UTC, rikki cattermole
wrote:
TLDR: no you cannot do what you were thinking.
Seems like something one ought to be able to do, though. DIP time?
On Thursday, 8 September 2016 at 22:13:26 UTC, Steven
Schveighoffer wrote:
I posted an article on this:
http://www.schveiguy.com/blog/2016/03/import-changes-in-d-2-071/
-Steve
Regarding that article:
Another import-related bug fix is to prevent unintentional
hijacking of symbols inside a
On Wednesday, 5 October 2016 at 19:30:01 UTC, Jonathan M Davis
wrote:
Would just like to point out that this is design weirdness on
Phobos' part - the library I've been writing does not have
this problem.
It doesn't even make conceptual sense for a static array to be
a range, because you
On Thursday, 6 October 2016 at 09:17:08 UTC, pineapple wrote:
On Wednesday, 5 October 2016 at 19:30:01 UTC, Jonathan M Davis
wrote:
Would just like to point out that this is design weirdness on
Phobos' part - the library I've been writing does not have
this problem.
It doesn't even make
On Wednesday, 5 October 2016 at 18:19:27 UTC, TheGag96 wrote:
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
On Wednesday, 7 September 2016 at 18:22:39 UTC, jmh530 wrote:
On Wednesday, 7 September 2016 at 18:10:45 UTC, pineapple wrote:
You might want to check out the ranges package of the library
I'm working on.
https://github.com/pineapplemachine/mach.d/tree/master/mach/range
There's a lot of
On Tuesday, 6 September 2016 at 14:38:54 UTC, Russel Winder wrote:
and I have no idea just now why it is complaining, nor what to
do to fix it.
You might want to check out the ranges package of the library I'm
working on.
https://github.com/pineapplemachine/mach.d/tree/master/mach/range
I would just love if I could express this as something more like
context(auto file = File("some_file.txt")){
file.write();
}
I've grown to very much appreciate how context initialization and
teardown can be very conveniently handled using `with` in Python.
Is there any clean way to imitate this syntax in D?
On Friday, 26 August 2016 at 23:30:15 UTC, Cauterite wrote:
On Friday, 26 August 2016 at 23:28:27 UTC, pineapple wrote:
I've grown to very much appreciate how context initialization
and teardown can be very conveniently handled using `with` in
Python. Is there any clean way to imitate this
I'd really like to define my own types that accept indexes for
opIndex and opSlice as template arguments. Is there any way to do
this? If not, this seems like an obvious thing to add to the
language - what's been holding it back?
On Monday, 3 October 2016 at 19:25:59 UTC, Uranuz wrote:
When I pass empty string to splitter in most of languages I
expect to get list with 1 item (empty string) as a result, but
I get error instead. And I see inconsistency in that .front
behaves normally, but .back is not. Usually I access
On Sunday, 25 September 2016 at 04:54:31 UTC, grampus wrote:
Dear all
For example, I have a struct
struct point{int x;int y}
point a;
Is there an easy way to access x and y by using a["x"] and
a["y"]
I guess I need to overload [], but can't figure out how.
Someone can help? Thank you very
On Sunday, 25 September 2016 at 16:07:59 UTC, Basile B. wrote:
WooW I have to say that I'm mesmerized !
How can this works ? "member" is run time variable so the
return type shouldn't be inferable.
The int fields are promoted to and returned as floats.
On Saturday, 1 October 2016 at 17:55:08 UTC, Uranuz wrote:
On Saturday, 1 October 2016 at 17:32:59 UTC, Uranuz wrote:
On Saturday, 1 October 2016 at 17:23:16 UTC, Uranuz wrote:
[...]
But these example fails. Oops. Looks like a bug(
import std.stdio;
import std.algorithm;
import std.range;
On Saturday, 1 October 2016 at 14:43:31 UTC, Adam D. Ruppe wrote:
On Saturday, 1 October 2016 at 14:41:22 UTC, Andrew wrote:
Is there any way to get the system date at compile time.
Not exactly, but the special symbol __TIMESTAMP__ gets a string
out of the compiler at build time.
On Thursday, 27 October 2016 at 22:17:35 UTC, WhatMeWorry wrote:
I'm using Derelict GLFW3 and I found the following GLFW3 code
snippet in a demo.
In a small demo, crap like this usually isn't a big deal.
It's not common practice, though, and for good reason. You should
definitely avoid
On Thursday, 10 November 2016 at 16:47:30 UTC, Adam D. Ruppe
wrote:
On Thursday, 10 November 2016 at 16:41:56 UTC, Charles Hixson
wrote:
It's *supposed* to be nan, and the assert message reports that
it is, but it should pass the assert test, not throw an
assertion. What am I doing wrong?
I'm trying to do some math stuff with std.bigint and realized
there's no obvious way to calculate the ceil of log2 of a bigint.
Help?
On Wednesday, 2 November 2016 at 14:24:42 UTC, Andrea Fontana
wrote:
On Wednesday, 2 November 2016 at 14:05:50 UTC, pineapple wrote:
I'm trying to do some math stuff with std.bigint and realized
there's no obvious way to calculate the ceil of log2 of a
bigint. Help?
How big are your bigints?
On Tuesday, 11 October 2016 at 07:55:36 UTC, orip wrote:
I get "Error: mismatched function return type inference" errors
with choosing the return type for functions that work on ranges
using, e.g, std.algorithm or std.range functions, but have
different behavior based on runtime values. The
On Wednesday, 4 January 2017 at 19:20:31 UTC, Nestor wrote:
On Wednesday, 4 January 2017 at 18:48:59 UTC, Daniel Kozák
wrote:
Ok, I've done some testing and you are right byLine is broken,
so please fill a bug
A bug? I was under the impression that this function was
*intended* to work only
On Friday, 6 January 2017 at 06:24:12 UTC, rumbu wrote:
I'm not sure if this works quite as intended, but I was at
least able to produce a UTF-16 decode error rather than a
UTF-8 decode error by setting the file orientation before
reading it.
import std.stdio;
import
On Wednesday, 28 December 2016 at 02:08:44 UTC, Guy Asking a
Question wrote:
import test; <---dmd choking here.
You will need to use the -I option of dmd/rdmd to inform the
compiler of where your `HopefullySomeDLibrary` directory is
located, as well as any other places you will want to
On Monday, 19 December 2016 at 09:24:38 UTC, Ali wrote:
Ok so laziness stops as soon as sort is required on a range
then? Ahh, because in place algorithms? Are there any plans in
D to make is to that you can output copies to collections so
that you could do something like filter.transpose.sort
On Friday, 3 March 2017 at 18:09:02 UTC, Jonathan M. Wilbur wrote:
I have tried to come up with a good way to get the mantissa,
exponent, and base from a real number, and I just can't come up
with a good cross-platform way of doing it. I know about
std.math.frexp(), but that function only
On Saturday, 22 July 2017 at 20:55:06 UTC, kerdemdemir wrote:
And what if I want to go diagonal like 1,5,9 or 3,5,7 in the
example above. Is there a good solution in std without using
for loops?
I suggest using an actual matrix type for tasks like this. I
don't know about diagonal slicing,
It is worth noting too that mach's map function will not behave
this way; UTF encoding and decoding is instructed explicitly and
is not done implicitly like in phobos.
https://github.com/pineapplemachine/mach.d
import mach.range : map, asarray;
import mach.text.ascii : toupper;
On Friday, 12 May 2017 at 21:23:23 UTC, Steven Schveighoffer
wrote:
Note, you can achieve what you want with version(unittest):
Please prefer `private version(unittest){...}` if the module
might be imported by someone else's code, as to not pollute it
with unneeded symbols
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?
0 objectpool 0x000104e9a3bc
I've managed to get a few functions working before mostly by
copying whatever Phobos was doing for a similar purpose, but now
that I'm trying to do something different I am really hitting a
wall.
My issue is that I can't figure out how to access a function's
arguments from within inline asm
On Thursday, 15 November 2018 at 21:00:10 UTC, Adam D. Ruppe
wrote:
It would be part of the abi:
https://dlang.org/spec/abi.html#function_calling_conventions
though it references C so you might need to look that up too.
That's helpful, thank you!
For other sized structs and static arrays,
On Thursday, 15 November 2018 at 21:12:39 UTC, Adam D. Ruppe
wrote:
On Thursday, 15 November 2018 at 21:07:51 UTC, pineapple wrote:
Is there a way to access this pointer?
It is passed as.. I think the final argument to the function.
(unless it is the first, do a quick test to find out).
Ah, I've got something working!
It's not exactly what I wanted, but it's good enough for now.
Instead of using an invisible output pointer, the output pointer
is passed in explicitly.
struct Result {
ulong low;
ulong high;
}
void retTest(Result* result) {
On Thursday, 15 November 2018 at 21:48:46 UTC, kinke wrote:
The MS docs are complete IIRC. The pointer to the pre-allocated
result of your 16-bytes struct is passed in RCX.
If unsure, just reverse-engineer what you need: type it down in
normal D and analyze the generated assembly. You can even
Well, for anyone who is tangling with similar mysteries, I
finally got something to work the way I wanted it to. Thank you
for the help, Adam and kinke!
The first "x" argument was stored in R8. The second "y" argument
was stored in RDX. The invisible return value pointer was stored
in RCX.
I do mach.d - https://github.com/pineapplemachine/mach.d
I've been setting up CI tests and OSX and Linux tests are good to
go thanks to Travis. I'm having a little more difficulty with
testing on Windows via AppVeyor, since DMD is too memory-hungry
to `dub test` without a fatal error when DMD
Speaking of which, is there any AppVeyor config or script laying
around somewhere for how to install 64-bit DMD? Since I would
ideally like to automate testing with both 32-bit and 64-bit DMD
101 - 146 of 146 matches
Mail list logo