On Saturday, 25 February 2017 at 19:59:29 UTC, ikod wrote:
Hello,
I have a method for range:
struct Range {
immutable(ubyte[]) _buffer;
size_t _pos;
@property void popFront() pure @safe {
enforce(_pos < _buffer.length, "popFront from empty
buffer");
There are a few options:
1. static if(audio)
2. version(audio)
3. if (audio)
It looks like you are trying to create the version(audio)
semantic(if exists then use, else don't).
Ultimately, though, if you are trying to make a binary that
can either use audio or not depending on where it is
On Wednesday, 22 February 2017 at 21:27:47 UTC, WhatMeWorry wrote:
I'm doing conditional compilation using static ifs like so:
enum bool audio = true;
// if audio flag is present and set to true, add to code build
static if ( (__traits(compiles, audio)) && audio)
On Friday, 17 February 2017 at 20:06:19 UTC, berni wrote:
I wonder if it's possible to do something like this:
import std.stdio;
void main(string[] args)
{
if (args[1]=="a")
{
write("A");
scope (exit) write("B");
}
write("C");
}
I expected the output to be ACB not
On Friday, 10 February 2017 at 03:07:28 UTC, Adam D. Ruppe wrote:
On Friday, 10 February 2017 at 02:53:50 UTC, Era Scarecrow
In cases like these i really wish the structure of the
class/struct had a hash or something (based on source or
struct layout or something)
They do have different
On Wednesday, 1 February 2017 at 19:25:07 UTC, Ali Çehreli wrote:
tl;dr - Seeking thoughts on trusting a system that allows
"handling" errors.
One of my extra-curricular interests is the Mill CPU[1]. A
recent discussion in that context reminded me of the
Error-Exception distinction in
On Saturday, 4 February 2017 at 14:35:37 UTC, ag0aep6g wrote:
On 02/04/2017 12:31 PM, Profile Anaysis wrote:
I am trying to iterate over the combinations of a set using
the code
https://rosettacode.org/wiki/Power_set#D
I have an array which I call powerSet on and I get a result of
MapResult.
I am trying to iterate over the combinations of a set using the
code
https://rosettacode.org/wiki/Power_set#D
I have an array which I call powerSet on and I get a result of
MapResult. I have tried to foreach or front/popFront and even
each() on it but I can never get the result as the same
I'd like to have a global variable in a module but it must be
accessed by the module name outside of the module.
Sort of like a static variable in a class.
private blocks it completely and public will allow it to be
imported in to the global scope. Haven't tried protected but I
assume that
On Saturday, 4 February 2017 at 06:54:01 UTC, Ali Çehreli wrote:
On 02/03/2017 08:47 PM, Profile Anaysis wrote:
What is the overhead of using a fiber?
The performance overhead of call() and yield() are comparable
to function calls because it's simply a few register
assignments in each case.
What is the overhead of using a fiber?
Error Error: cannot append type int[] to type int[2][]
This is because I tried to slice too small [0..1] when I was
suppose to do [0..2](which passes). The error message is
deceiving because it makes it look like the append can't happen
when it can.
Should be something
On Tuesday, 31 January 2017 at 15:21:42 UTC, Vladimir Panteleev
wrote:
On Tuesday, 31 January 2017 at 13:11:22 UTC, Profile Anaysis
wrote:
The web interface could use a little work!
1. Tabs - I know that tabs are designed to move to different
elements but you can override the default behavior
The web interface could use a little work!
1. Tabs - I know that tabs are designed to move to different
elements but you can override the default behavior and make life
quite a bit easier for most people(since most people have access
to a mouse).
On Tuesday, 31 January 2017 at 11:31:28 UTC, Ali Çehreli wrote:
On 01/31/2017 03:00 AM, Profile Anaysis wrote:
> [...]
[...]
> [...]
return type.
Options:
[...]
Thanks again!
On Tuesday, 31 January 2017 at 06:32:02 UTC, Ali Çehreli wrote:
On 01/30/2017 08:12 PM, Profile Anaysis wrote:
import std.stdio, std.concurrency, core.thread;
class Search : Fiber
{
this() { super(); }
int res = 0;
void start()
{
Fiber.yield();
res = 1;
}
}
On Tuesday, 31 January 2017 at 06:32:02 UTC, Ali Çehreli wrote:
On 01/30/2017 08:12 PM, Profile Anaysis wrote:
[...]
That's because the fiber is not in a callable state. (You can
check with search.state.) Here is one where the fiber function
lives (too) long:
import std.stdio,
On Monday, 30 January 2017 at 18:48:10 UTC, Ali Çehreli wrote:
On 01/30/2017 03:03 AM, Profile Anaysis wrote:
> I need to yield from a complex recursive function too allow
visualizing
> what it is doing.
>
> e.g., if it is a tree searching algorithm, I'd like to yield
for each
> node so that the
On Monday, 30 January 2017 at 22:34:11 UTC, TheFlyingFiddle wrote:
On Monday, 30 January 2017 at 11:03:52 UTC, Profile Anaysis
wrote:
I need to yield from a complex recursive function too allow
visualizing what it is doing.
e.g., if it is a tree searching algorithm, I'd like to yield
for
I need to yield from a complex recursive function too allow
visualizing what it is doing.
e.g., if it is a tree searching algorithm, I'd like to yield for
each node so that the current state can be shown visually.
I realize that there are several ways to do this but D a yield
version
the code from
https://dlang.org/library/std/concurrency/generator.html
gives a seg fault at the end.
import std.concurrency;
import std.stdio;
void main()
{
auto tid = spawn(
{
while (true)
{
writeln(receiveOnly!int());
}
});
auto r = new
On Friday, 27 January 2017 at 11:16:09 UTC, Patrick Schluter
wrote:
On Thursday, 26 January 2017 at 00:02:03 UTC, Profile Anaysis
wrote:
[...]
It's funny (or sad) that C has compound types since C99 and
that they are good.
Your foo(|a,b,|c1,c2,3||,|e|,|f,g,c|) writes as
On Friday, 27 January 2017 at 12:44:30 UTC, rjframe wrote:
On Fri, 27 Jan 2017 10:38:53 +, Profile Anaysis wrote:
Do you realize
1. That without change there can be no progress?
...
If people with your mentality rules the world we would still
be using
sticks and stones. This is a
On Friday, 27 January 2017 at 19:32:29 UTC, Jesse Phillips wrote:
On Thursday, 26 January 2017 at 00:02:03 UTC, Profile Anaysis
wrote:
Many times we pass compound types(non-primitives) as arguments
to functions.
I don't understand what issue you are solving. I see an
undefined syntax:
On Friday, 27 January 2017 at 09:47:48 UTC, Bauss wrote:
On Thursday, 26 January 2017 at 00:02:03 UTC, Profile Anaysis
wrote:
Many times we pass compound types(non-primitives) as arguments
to functions.
[...]
This is going to be a no from me. It's just another syntactic
sugar that doesn't
test1.obj : fatal error LNK1179: invalid or corrupt file:
duplicate COMDAT
'_D4main4mainFAAyaZ16__T3recVii1TAAiZ3recMFNfAAiZv (@safe void
main.main(immutable(char)[][]).rec!(1, int[][]).rec(int[][]))'
code
import std.stdio;
import std.traits, std.meta, std.conv, std.string,
Why not make enum a comparable type to structs and classes?
They are static so they can't contain any mutable fields but
surely they can contain methods? And especially they should be
able to contain static methods!?
Since we do not have attributes for enums, I use _ in front of
the names for meta values.
I need to get the non-meta values for the enum so I can iterate
over it and use it properly.
enum myEnum
{
_Meta1 = 0,
A,B,C,
_Meta3 = 43,
D = 3,
}
The num, for all practical purposes
On Thursday, 26 January 2017 at 03:02:32 UTC, Jonathan M Davis
wrote:
On Thursday, January 26, 2017 01:47:53 Profile Anaysis via
Digitalmars-d- learn wrote:
[...]
Like in C/C++, types are mostly read outward from the variable
name in D. In both C/C++ and D,
[...]
Actually, I think
On Thursday, 26 January 2017 at 03:02:32 UTC, Jonathan M Davis
wrote:
On Thursday, January 26, 2017 01:47:53 Profile Anaysis via
Digitalmars-d- learn wrote:
[...]
Like in C/C++, types are mostly read outward from the variable
name in D. In both C/C++ and D,
[...]
Thanks. I'll just
On Thursday, 26 January 2017 at 02:29:07 UTC, Ivan Kazmenko wrote:
On Thursday, 26 January 2017 at 01:47:53 UTC, Profile Anaysis
wrote:
does this mean that have
int[][4][4] matrix_history;
backwards?
int[4][4][] matrix_history;
this creates even a more set of problems.
In short,
I'm a bit confused by how D does arrays.
I would like to create a array of matrices but I do not seem to
get the correct behavior:
int[][4][4] matrix_history;
What I would like is to have a 4x4 matrix and have a history of
it. Just n 4x4 matrices but each matrix is a fixed size but
Many times we pass compound types(non-primitives) as arguments to
functions.
e.g.,
void foo(T1 t1, T2 t2, T3, t3);
But to call foo with new variables we have to create the
arguments. This usually requires extra code to simply initialize
the variables. (imagine foo being a constructor).
I am trying to compile some code and it takes around 6 seconds.
Even if I change one line in one module, it takes the same time.
There are about 20 different d modules.
I used to get around 1-2 second compile times several months ago
on different projects.
I did upgrade a few things and it
test.d(22): Error: cannot append type test.Path to type test.Path
This is due to the changing some code that was appending.
Obviously we can't append a type to itself.
Would be nice if the error message was more clear like:
Type test.Path is not an array. Cannot append to itself.
On Tuesday, 24 January 2017 at 21:36:50 UTC, Profile Anaysis
wrote:
...
Maybe with all this talk of the new CTFE engine being developed,
a similar mechanism can be used optionally? This could help with
debugging also.
In debug mode, the cfte mixin's are written to disk with hash, if
they
On Tuesday, 24 January 2017 at 16:49:03 UTC, TheFlyingFiddle
wrote:
On Tuesday, 24 January 2017 at 16:41:13 UTC, TheFlyingFiddle
wrote:
Everything turned out s much better than expected :)
Added bonus is that mixin output can be viewed in the generated
files :D
Could you post your
On Monday, 23 January 2017 at 01:46:58 UTC, FatalCatharsis wrote:
On Monday, 23 January 2017 at 00:46:30 UTC, Profile Anaysis
wrote:
The real issue is ambiguity. Any time you have a cycle you
must be able to get out of it and so your rules must be
organized so that one always checks to see if
On Sunday, 22 January 2017 at 22:11:08 UTC, FatalCatharsis wrote:
I'm writing a flex lexer for D and I've hit a roadblock. It is
almost working EXCEPT for one specific production.
StringLiteral is cyclic and I don't know how to approach it. It
is cyclic because:
Token -> StringLiteral
39 matches
Mail list logo