On Tuesday, December 18, 2018 9:20:11 AM MST berni via Digitalmars-d-learn
wrote:
> On Tuesday, 18 December 2018 at 14:32:29 UTC, Adam D. Ruppe wrote:
> > CTFE is used if and only if it MUST be used by context. That's
> > a runtime function, so no ctfe.
> >
> > Do something like:
> >
> > int[4]
On Tuesday, December 18, 2018 5:42:12 AM MST rikki cattermole via
Digitalmars-d-learn wrote:
> On 19/12/2018 1:34 AM, Per Nordlöw wrote:
> > On Tuesday, 18 December 2018 at 10:42:51 UTC, Jonathan M Davis wrote:
> >> Unfortunately, D does not currently have a way to do that. Only
> >> functions
On Tue, Dec 18, 2018 at 10:29:07PM +, JN via Digitalmars-d-learn wrote:
> On Monday, 17 December 2018 at 22:22:05 UTC, H. S. Teoh wrote:
> > A less likely possibility might be an optimizer bug -- do you get
> > different results if you add / remove '-O' (and/or '-inline') from
> > your dmd
On Monday, 17 December 2018 at 22:22:05 UTC, H. S. Teoh wrote:
A less likely possibility might be an optimizer bug -- do you
get different results if you add / remove '-O' (and/or
'-inline') from your dmd command-line? If some combination of
-O and -inline (or their removal thereof) "fixes"
On 14/12/2018 02:56, Steven Schveighoffer wrote:
> On 12/13/18 7:16 PM, Michelle Long wrote:
>> byte x = 0xF;
>> ulong y = x >> 60;
>
> Surely you meant x << 60? As x >> 60 is going to be 0, even with a ulong.
It doesn't work as intuitive as you'd expect:
void main()
{
int x = 256;
On 12/17/18 8:18 PM, Neia Neutuladh wrote:
On Mon, 17 Dec 2018 22:20:54 +, harfel wrote:
I am looking for a way to serialize/deserialize the state of the
std.random.Random number generator, ideally using orange
(https://github.com/jacob-carlborg/orange) or another serialization
library.
On Tuesday, 18 December 2018 at 13:52:29 UTC, Steven
Schveighoffer wrote:
On 12/18/18 6:29 AM, Simen Kjærås wrote:
On Tuesday, 18 December 2018 at 10:14:50 UTC, Per Nordlöw
wrote:
What's the preferred way of creating a temporary @trusted
scope without writing a separate function?
Jonathan's
On 12/18/18 10:53 AM, H. S. Teoh wrote:
On Tue, Dec 18, 2018 at 08:52:29AM -0500, Steven Schveighoffer via
Digitalmars-d-learn wrote:
On 12/18/18 6:29 AM, Simen Kjærås wrote:
On Tuesday, 18 December 2018 at 10:14:50 UTC, Per Nordlöw wrote:
What's the preferred way of creating a temporary
On Tuesday, 18 December 2018 at 16:19:33 UTC, unDEFER wrote:
Yes, thank you for the hint. You are almost right. I did not
ENABLE_DEBUG=1, but I also did not ENABLE_RELEASE=1
So it is the bug. I will report about it.
https://issues.dlang.org/show_bug.cgi?id=19500
On Tuesday, 18 December 2018 at 14:32:29 UTC, Adam D. Ruppe wrote:
CTFE is used if and only if it MUST be used by context. That's
a runtime function, so no ctfe.
Do something like:
int[4] generate() {
int[4] tmp;
foreach(i; 0..4) tmp[i] = i;
return tmp;
}
static immutable int[4]
On Tuesday, 18 December 2018 at 15:54:28 UTC, Seb wrote:
On Tuesday, 18 December 2018 at 14:35:46 UTC, unDEFER wrote:
What I could build wrong and how to build dmd properly?
Maybe you built dmd.d with debug assertions? (ENABLE_DEBUG=1)
You can build dmd with the `./build.d` script or `make
On Tuesday, 18 December 2018 at 14:35:46 UTC, unDEFER wrote:
What I could build wrong and how to build dmd properly?
Maybe you built dmd.d with debug assertions? (ENABLE_DEBUG=1)
You can build dmd with the `./build.d` script or `make -f
posix.mak -j4` (assuming you are in `src).
Anyway,
On Tue, Dec 18, 2018 at 08:52:29AM -0500, Steven Schveighoffer via
Digitalmars-d-learn wrote:
> On 12/18/18 6:29 AM, Simen Kjærås wrote:
> > On Tuesday, 18 December 2018 at 10:14:50 UTC, Per Nordlöw wrote:
> > > What's the preferred way of creating a temporary @trusted scope
> > > without writing
Hello, I have the next code (minimized with DustMite):
struct Tup(T...)
{
bool opEquals() {
foreach (i; T)
static if (__traits(compiles, mixin("new
InputRangeObject11261!(abs_class)")))
msg;
}
}
/**/
void test3()
{
On Tuesday, 18 December 2018 at 13:52:29 UTC, Steven
Schveighoffer wrote:
template unsafe(alias fn) {
@trusted auto unsafe(T...)(T args) {
return fn(args);
}
}
Very nice! What about proposing this for inclusion into
`std.typecons` or `std.meta`?
On Tuesday, 18 December 2018 at 14:23:38 UTC, berni wrote:
import std.stdio;
class A
{
static immutable int[4] clue;
static this()
{
if(__ctfe) assert(0, "Yep, CTFE used");
foreach (i;0..4) clue[i] = i;
}
}
CTFE is used if and only if it MUST be used by
On Tuesday, 18 December 2018 at 13:53:01 UTC, Stefan Koch wrote:
Why would you need to know?
Well, first out of curiosity. But there are also other reasons:
I've got a large immutable array. Without CTFE I'd use some php
script and add it as a large literal. With CTFE I don't need that
php
On Tuesday, 18 December 2018 at 12:47:59 UTC, Andrey wrote:
On Tuesday, 18 December 2018 at 12:32:35 UTC, angel wrote:
On Tuesday, 18 December 2018 at 12:07:37 UTC, Andrey wrote:
Thank you everybody.
Here was another problem that local variable 'array' shadows
function 'array()' from
On 12/17/18 5:09 PM, Anonymouse wrote:
I have a JSON string[][string] associative array object that I want to
take the .toPrettyString value of. However, it sorts the output
alphabetically.
string[][string] aa = [ "abc" : [], "def" : [], "ghi" : [] ];
auto asJSON = JSONValue(aa);
On 12/18/18 7:21 AM, berni wrote:
Is there a way to check if a function is indeed executed at compile time
or not? (Other than going through the whole executable binaries...)
I tried
static this()
{
if (__ctfe) pragma(msg,"works");
// some other stuff
}
but unfortunatley this "if" is
On 12/18/18 6:29 AM, Simen Kjærås wrote:
On Tuesday, 18 December 2018 at 10:14:50 UTC, Per Nordlöw wrote:
What's the preferred way of creating a temporary @trusted scope
without writing a separate function?
Jonathan's idea might also be encapsulated in a function, just like
assumeUnique in
On Tuesday, 18 December 2018 at 12:21:44 UTC, berni wrote:
Is there a way to check if a function is indeed executed at
compile time or not? (Other than going through the whole
executable binaries...)
I tried
static this()
{
if (__ctfe) pragma(msg,"works");
// some other stuff
}
but
On Tue, Dec 18, 2018 at 1:25 PM berni via Digitalmars-d-learn <
digitalmars-d-learn@puremagic.com> wrote:
> Is there a way to check if a function is indeed executed at
> compile time or not? (Other than going through the whole
> executable binaries...)
>
> I tried
>
> > static this()
> > {
> >
On Tuesday, 18 December 2018 at 12:32:35 UTC, angel wrote:
On Tuesday, 18 December 2018 at 12:07:37 UTC, Andrey wrote:
Thank you everybody.
Here was another problem that local variable 'array' shadows
function 'array()' from std.array.
On 19/12/2018 1:34 AM, Per Nordlöw wrote:
On Tuesday, 18 December 2018 at 10:42:51 UTC, Jonathan M Davis wrote:
Unfortunately, D does not currently have a way to do that. Only
functions can be marked with @trusted. However, the typical approach
to this problem is to use a lambda, which is more
On Tuesday, 18 December 2018 at 12:07:37 UTC, Andrey wrote:
Hi,
Have array:
enum array = ["qwerty", "a", "baz"];
Need to reverse and sort array elements to get this result:
[a, ytrewq, zab]
Did this:
enum result = array.map!(value => value.retro()).sort();
Got:
Error: template
On Tuesday, 18 December 2018 at 12:07:37 UTC, Andrey wrote:
Hi,
Have array:
enum array = ["qwerty", "a", "baz"];
Need to reverse and sort array elements to get this result:
[a, ytrewq, zab]
Did this:
enum result = array.map!(value => value.retro()).sort();
Got:
Error: template
On Tuesday, 18 December 2018 at 10:42:51 UTC, Jonathan M Davis
wrote:
Unfortunately, D does not currently have a way to do that. Only
functions can be marked with @trusted. However, the typical
approach to this problem is to use a lambda, which is more or
less syntactically the same except
Is there a way to check if a function is indeed executed at
compile time or not? (Other than going through the whole
executable binaries...)
I tried
static this()
{
if (__ctfe) pragma(msg,"works");
// some other stuff
}
but unfortunatley this "if" is also executed at compile time,
On Tuesday, 18 December 2018 at 01:16:54 UTC, Adam D Ruppe wrote:
They're obvious. Stuff like doubled ; at the end of lines in
code samples, or curly quotes when they should be straight.
(They are the result of me fighting Microsoft Word and the
review process with the publisher.)
A few
Hi,
Have array:
enum array = ["qwerty", "a", "baz"];
Need to reverse and sort array elements to get this result:
[a, ytrewq, zab]
Did this:
enum result = array.map!(value => value.retro()).sort();
Got:
Error: template std.algorithm.sorting.sort cannot deduce
function from argument types
On Tuesday, 18 December 2018 at 10:14:50 UTC, Per Nordlöw wrote:
What's the preferred way of creating a temporary @trusted scope
without writing a separate function?
Jonathan's idea might also be encapsulated in a function, just
like assumeUnique in Phobos:
import std.stdio;
template
On Tuesday, December 18, 2018 3:14:50 AM MST Per Nordlöw via Digitalmars-d-
learn wrote:
> What's the preferred way of creating a temporary @trusted scope
> without writing a separate function?
>
> Similar to Rust's
>
> unsafe { /* unsafe stuff here */ }
Unfortunately, D does not currently have
What's the preferred way of creating a temporary @trusted scope
without writing a separate function?
Similar to Rust's
unsafe { /* unsafe stuff here */ }
34 matches
Mail list logo