On 10/3/23 00:11, Salih Dincer wrote:
Hi,
opIndexAssign, which is void, cannot compromise with opIndex, which is a
ref! Solution: Using opSliceAssign. Could this be a bug? Because
there is no problem in older versions (e.g. v2.0.83).
```d
struct S
{
int[] i;
ref opIndex(size_t
On 6/9/23 06:05, An Pham wrote:
Getting with below error for following codes. Look like bug?
onlineapp.d(61): Error: scope variable `a` assigned to non-scope
parameter `a` calling `foo`
@safe:
struct A(S = string)
{
@safe:
S s;
void delegate() c;
}
On 4/1/23 17:02, Ali Çehreli wrote:
Does anyone have documentation on why Rust and Zip does not do thread
local by default?
Rust just does not do mutable globals except in unsafe code.
On 7/30/22 15:19, Salih Dincer wrote:
On Saturday, 30 July 2022 at 10:02:50 UTC, Timon Gehr wrote:
It's a `const` hole, plain and simple.
This code, which consists of 26 lines, does not compile in DMD 2.087. I
am getting this error:
constHole.d(15): Error: mutable method
On 7/30/22 00:16, H. S. Teoh wrote:
On Fri, Jul 29, 2022 at 09:56:20PM +, Andrey Zherikov via
Digitalmars-d-learn wrote:
In the example below `func` changes its `const*` argument. Does this
violates D's constness?
```d
import std;
struct S
{
string s;
void delegate(string s)
On 11.04.22 11:11, Salih Dincer wrote:
How is this possible? Why is it compiled? Don't the same names in the
same scope conflict?
```d
int function(int) square;
void main()
{
square = (int a) => a * a;
int square = 5.square;
assert(square == 25);
}
```
Thanks, SDB@79
- Local
On 12/8/21 9:07 AM, Petar Kirov [ZombineDev] wrote:
On Wednesday, 8 December 2021 at 07:55:55 UTC, Timon Gehr wrote:
On 08.12.21 03:05, Andrey Zherikov wrote:
On Tuesday, 7 December 2021 at 18:50:04 UTC, Ali Çehreli wrote:
I don't know whether the workaround works with your program
On 08.12.21 03:05, Andrey Zherikov wrote:
On Tuesday, 7 December 2021 at 18:50:04 UTC, Ali Çehreli wrote:
I don't know whether the workaround works with your program but that
delegate is the equivalent of the following struct (the struct should
be faster because there is no dynamic context
On 03.10.20 13:18, tspike wrote:
I came across an issue recently that I’m a little confused by. The
following program fails to compile under LDC and DMD, though it compiles
fine under GDC:
@nogc:
void main()
{
static foreach(i; 0 .. 4)
{
On 09.03.20 13:14, Adam D. Ruppe wrote:
Here's a wiki page referencing one of the 2013 discussions
https://wiki.dlang.org/Property_Discussion_Wrap-up
https://wiki.dlang.org/DIP24
On 07.03.20 17:41, MoonlightSentinel wrote:
On Saturday, 7 March 2020 at 16:30:59 UTC, Robert M. Münch wrote:
Is this possible at all?
You can use an anonymous lambda to build the string in CTFE:
It turns out that if you do use this standard idiom, you might end up
getting blamed for an
On 01.03.20 21:58, p.shkadzko wrote:
**
Matrix!T matrixDotProduct(T)(Matrix!T m1, Matrix!T m2)
in
{
assert(m1.rows == m2.cols);
This asserts that the result is a square matrix. I think you want
`m1.cols==m2.rows` instead.
On 07.12.19 05:00, Marcone wrote:
import std;
alias cmd = compose!(to!bool, wait, spawnShell, to!string);
void main(){
writeln(cmd("where notepad.exe"));
}
Result:
C:\Windows\System32\notepad.exe
C:\Windows\notepad.exe
false
The result show "false" because good spawnshell command
On 27.11.19 11:43, ixid wrote:
On Tuesday, 26 November 2019 at 16:33:06 UTC, Timon Gehr wrote:
import std;
void main(){
int[] x=[1,1,2,3,4,4];
int[][] y=x.chunkBy!((a,b)=>a==b).map!array.array;
writeln(y);
}
This stuff is a nightmare for less experienced users like myself, I w
On 26.11.19 23:08, Taylor R Hillegeist wrote:
On Tuesday, 26 November 2019 at 16:33:06 UTC, Timon Gehr wrote:
int[][] y=x.chunkBy!((a,b)=>a==b).map!array.array;
how did you know to do that?
chunkBy with a binary predicate returns a range of ranges. So if I want
an array of array
On 26.11.19 06:05, Taylor R Hillegeist wrote:
I'm attempting to do a segment group.
details:
alias ProbePoint[3]=triple;
triple[] irqSortedSet = UniqueTriples.keys
.sort!("a[1].irqid < b[1].irqid",SwapStrategy.stable)
.array;
83:triple[][] irqSortedSets =
On 25.11.19 10:00, Dukc wrote:
On Monday, 25 November 2019 at 03:07:08 UTC, Fanda Vacek wrote:
Is this preferred design pattern?
```
int main()
{
int a = 1;
//ref int b = a; // Error: variable `tst_ref.main.b` only
parameters or `foreach` declarations can be `ref`
ref int b() {
On 10.08.19 16:29, John Colvin wrote:
Ok. What would go wrong (in D) if I just replaced every interface with
an abstract class?
interface A{}
interface B{}
class C: A,B{ }
On 22.07.19 14:49, drug wrote:
I have almost identical (I believe it at least) implementation (D and
C++) of the same algorithm that uses Kalman filtering. These
implementations though show different results (least significant
digits). Before I start investigating I would like to ask if this
On 15.06.19 18:29, Rémy Mouëza wrote:
On Saturday, 15 June 2019 at 01:21:46 UTC, Emmanuelle wrote:
On Saturday, 15 June 2019 at 00:30:43 UTC, Adam D. Ruppe wrote:
On Saturday, 15 June 2019 at 00:24:52 UTC, Emmanuelle wrote:
Is it a compiler bug?
Yup, a very longstanding bug.
You can work
On 23.05.19 12:21, Alex wrote:
On Wednesday, 22 May 2019 at 00:55:37 UTC, Adam D. Ruppe wrote:
On Wednesday, 22 May 2019 at 00:22:09 UTC, JS wrote:
I am trying to create some fast sin, sinc, and exponential routines
to speed up some code by using tables... but it seems it's slower
than the
On 02.05.19 09:28, Stefan Koch wrote:
On Thursday, 2 May 2019 at 02:54:03 UTC, Andrey wrote:
Hello, I have got this code:
[...]
I want to sort array of tuples using "data" element in CTFE. But this
code give me errors:
[...]
As I understand the function "sort" sometimes can't be run
On 22.11.18 16:19, Steven Schveighoffer wrote:
In terms of language semantics, I don't know what the right answer is.
If we want to say that if an optimizer changes program behavior, the
code must be UB, then this would have to be UB.
But I would prefer saying something like -- if a
On 06.08.2018 14:37, Steven Schveighoffer wrote:
On 8/5/18 11:40 AM, Timon Gehr wrote:
On 05.08.2018 16:07, Steven Schveighoffer wrote:
So is this a bug? Is it expected?
It's a bug. The two copies of 'item' are not supposed to be the same
symbol. (Different types -> different symb
On 05.08.2018 16:07, Steven Schveighoffer wrote:
I have found something that looks like a bug to me, but also looks like
it could simply be a limitation of the foreach construct.
Consider this code:
struct Foo {}
enum isFoo(alias x) = is(typeof(x) == Foo);
void main()
{
Foo foo;
On 21.04.2018 12:08, Giles Bathgate wrote:
On Saturday, 21 April 2018 at 07:57:41 UTC, Uknown wrote:
The language itself doesn't have something, but you could use `alloca`
I don't know if this little template function makes life easier:
--
pragma(inline, true)
ref T push(T)(size_t len)
{
On 22.02.2018 01:26, Adam D. Ruppe wrote:
On Thursday, 22 February 2018 at 00:13:43 UTC, SrMordred wrote:
string x = "123";
auto c = x.ptr;
c++;
writeln(c[-1]); // 1
That's only happening because pointers bypass range checks.
writeln(c[-1..0]); //BOOM Range violation
But with a slice
On 21.01.2018 21:20, Mark wrote:
Just realized that I commented out the creation of the BST
new link: https://dpaste.dzfl.pl/ce620cbee919
'in' means 'const scope', but it seems you need references that are
allowed to mutate the incoming items. Remove the 'in' attribute from the
parameters
On 15.01.2018 20:05, xenon325 wrote:
I think, most clear code would be with tripple `foreach`, so I'll go
with that. But probably someone will come up with something better and
range-ier.
Suggestion are welcome!
import std.stdio, std.algorithm, std.range, std.array, std.conv,
std.json,
On 15.01.2018 22:51, Timon Gehr wrote:
auto aa(R)(R r){
typeof(r.front[1])[typeof(r.front[0])] a;
foreach(x;r) a[x[0]] = x[1];
return a;
}
Actually, better to use std.array.assocArray.
import std.stdio, std.algorithm, std.range, std.array, std.conv,
std.json, std.typecons
On 09.01.2018 22:04, H. S. Teoh wrote:
if (0 == 3) {}
// all subsequent iterations deleted
because the static break is unconditionally compiled (it has nothing to
do with the runtime branch). You'd have to use static if to make it
conditionally-compiled and thus not instantly
On 22.10.2017 16:20, Ilya Yaroshenko wrote:
.. i thought it should be (2 ^^ 1) ^^ 2 = 4
2 ^^ (1 ^^ 2) == 2
It is standard for ^/**/^^ to be right-associative. (This is also the
standard convention in mathematics.)
On 14.10.2017 23:36, kdevel wrote:
On Saturday, 14 October 2017 at 09:32:32 UTC, Timon Gehr wrote:
Also, UB can and does sometimes mean that the program can execute
arbitrary code. It's called "arbitrary code execution":
https://en.wikipedia.org/wiki/Arbitrary_code_execution
Thi
On 14.10.2017 07:20, Jesse Phillips wrote:
On Thursday, 12 October 2017 at 15:37:23 UTC, John Burton wrote:
This is an example of what I mean :-
undefined what it is meant to do anyway, so the compiler can
"optimize" out the if condition as it only affects the case where the
language
On 11.10.2017 11:27, John Burton wrote:
The spec says this :-
"As a contract, an assert represents a guarantee that the code must
uphold. Any failure of this expression represents a logic error in the
code that must be fixed in the source code. A program for which the
assert contract is
On 21.09.2017 17:53, Steven Schveighoffer wrote:
On 9/21/17 11:48 AM, Steven Schveighoffer wrote:
On 9/21/17 11:06 AM, Timon Gehr wrote:
foreach(i; 0 .. 4){
dfs(a + (i==0) - (i==1),
b + (i==2) - (i==3));
}
So am I, but I wasn't commenting
On 20.09.2017 23:13, nkm1 wrote:
Example of a good use:
void floodFill(dchar[][] data,dchar c,int i,int j) {
void dfs(int a, int b) {
Example of a good use:
void floodFill(dchar[][] data,dchar c,int i,int j) {
void dfs(int a, int b) {
if (a<0 || a >= data.length) return;
On 19.09.2017 23:17, nkm1 wrote:
...
OTOH, booleans converting to numbers is a very questionable feature. > I
certainly have never seen any good use for it. ...
Actually, it is useful enough to have a Wikipedia page:
https://en.wikipedia.org/wiki/Iverson_bracket
Example of a good use:
void
On 10.08.2017 15:22, Adam D. Ruppe wrote:
On Wednesday, 9 August 2017 at 23:52:00 UTC, Johnson Jones wrote:
extern(C) delegate(void*) {}
You should very rarely use extern(C) delegate... delegate is a D type,
so the C function is almost certainly not actually receiving it.
Only time you'd
On 10.08.2017 01:52, Johnson Jones wrote:
given somethign like Threads.threadsAddIdle
which takes an extern(C) int (void*)
we can't seem to do
threadsAddIdle((void*) { }, null);
I think this is a compiler bug. Try:
threadsAddIdle((x){ }, null);
It seems that the calling convention is
On 09.08.2017 21:00, Steven Schveighoffer wrote:
On 8/9/17 2:25 PM, Nordlöw wrote:
Why doesn't appending to `subs` work with std.array.Appender in
struct T
{
string src;
import std.array : Appender;
Appender!(T[]) subs;
}
T t;
t.subs ~=
On 29.07.2017 23:52, FoxyBrown wrote:
On Saturday, 29 July 2017 at 21:48:09 UTC, Timon Gehr wrote:
On 28.07.2017 23:30, FoxyBrown wrote:
because you didn't want to spend 10 minutes to fix a program.
You need to realize that the same thing applies to you. There is no
"us" vs
On 28.07.2017 23:30, FoxyBrown wrote:
because you didn't want to spend 10 minutes to fix a program.
You need to realize that the same thing applies to you. There is no "us"
vs "you". I.e. if you know it to only be 10 minutes of work, why don't
you just fix it yourself? Mike currently has as
On 24.07.2017 20:19, Suliman wrote:
Why D have two function `contains` and `canFind`
`contains` guarantees logarithmic running time, while `canFind` can be
linear.
On 22.07.2017 22:55, kerdemdemir wrote:
We have awesome way for creating slices like:
a = new int[5];
int[] b = a[0..2];
But what about if I have 2D array and I don't want to go vertical.
Something like :
int[3][3] matrix = [
[ 1, 2, 3 ],
[ 4, 5, 6 ],
[ 7, 8, 9 ]
];
On 16.07.2017 19:10, Timon Gehr wrote:
...
(This works even if there are * at the border.)
Well, not really. :)
Version that actually works if there are * at the border:
import std.stdio, std.range, std.algorithm, std.array;
char[][] arr;
int componentSize(int row,int col){
if(row
On 16.07.2017 18:55, Timon Gehr wrote:
On 16.07.2017 12:37, kerdemdemir wrote:
My goal is to find connected components in a 2D array for example
finding connected '*'
chars below.
x x x x x x
x x x x x x
x x * * x x
x x * * x x
x x x * * x
* x x x x x
On 16.07.2017 12:37, kerdemdemir wrote:
My goal is to find connected components in a 2D array for example
finding connected '*'
chars below.
x x x x x x
x x x x x x
x x * * x x
x x * * x x
x x x * * x
* x x x x x
There are two connected '*' group in
On 08.07.2017 19:16, kdevel wrote:
I wonder if this distinction is meaningful
Not nearly as much as it would need to be to justify the current
behavior. It's mostly a historical accident.
and---if not---why it is
exposed to the application programmer so prominently.
I don't think there
On 08.06.2017 14:06, Steven Schveighoffer wrote:
The issue here is that arrays are special. Arrays allow foreach(i, v;
arr) and foreach(v; arr). Ranges in general do not. So there is no way
to forward this capability via the range interface. Not only that, but
foreach(i, v; arr) is much
On 10.01.2017 04:02, Elronnd wrote:
Thank you! Would you mind telling me what you changed aside from pow()
and powm()?
1. This code:
// make 2^a = integer-1
while ((integer-1)%(pow(bigint(2), a))!=0)
a--;
m = (integer-1) / pow(bigint(2), a);
a starts out as integer-1, so this computes
On 08.01.2017 08:52, Elronnd wrote:
I'm working on writing an RSA implementation, but I've run into a
roadblock generating primes. With a more than 9 bits, my program either
hangs for a long time (utilizing %100 CPU!) or returns a composite
number. With 9 or fewer bits, I get primes, but I
On 15.12.2016 01:38, Basile B. wrote:
On Wednesday, 14 December 2016 at 22:06:35 UTC, Ali Çehreli wrote:
On 12/14/2016 09:25 AM, Basile B. wrote:
> On Tuesday, 13 December 2016 at 23:37:59 UTC, Timon Gehr
wrote:
>> I usually do
>>
>> enum code = q{expr};
>> static
On 14.12.2016 00:00, Timothee Cour via Digitalmars-d-learn wrote:
what's the best (and DRY) way to achieve:
```
static if(__traits(compiles, expr))
fun(expr);
```
ie, without repeating the expression inside expr?
eg:
```
static if(__traits(compiles, foo.bar[2])){
counter++;
writeln("
On 01.12.2016 21:12, Ali Çehreli wrote:
This is a common issue with D and some other languages (as I had learned
during a Dart language presentation, of which Dart does not suffer
from). All those delegates do close on the same loop variable. You need
to produce copies of the variable.
This
On 04.11.2016 09:04, Jacob Carlborg wrote:
I have a file with a bunch of lines I want to process. I want to process
these lines line by line. Most of these lines have the same pattern.
Some of the lines have a different pattern. I want to bundle those
lines, which have a non-standard pattern,
On 17.06.2016 23:00, Nordlöw wrote:
I want to create a function that takes a variadic number of arguments
all of a specific type, say T, without having to create GC-allocated
heap array.
Is there a better way than:
f(Args...)(Args args)
if (allSameType!(Args, T);
in terms of template
On 10.06.2016 13:02, Satoshi wrote:
Hello,
why operator overloading is not working as a static methods through the
UFCS?
...
It's an arbitrary limitation.
https://issues.dlang.org/show_bug.cgi?id=8062
(The specification has been updated in the meantime, it now documents
the limitation
On 30.05.2016 18:22, Max Samukha wrote:
From the spec (https://dlang.org/spec/function.html#nested): "Nested
functions cannot be overloaded."
Anybody knows what's the rationale?
The rationale is that nobody has implemented it in DMD.
https://issues.dlang.org/show_bug.cgi?id=12578
On 25.05.2016 01:19, Elie Morisse wrote:
On Saturday, 13 October 2012 at 22:58:56 UTC, Timon Gehr wrote:
Afaik free-function operator overloads (but not in the context of
UFCS) were considered and turned down because D did not want to get
amidst discussions about adding Koenig lookup. UFCS does
On 22.04.2016 21:52, Nordlöw wrote:
On Friday, 22 April 2016 at 17:37:44 UTC, Nordlöw wrote:
Have anybody implement Ada-style modulo types
https://en.wikibooks.org/wiki/Ada_Programming/Types/mod
Here's my first try
https://github.com/nordlow/phobos-next/blob/master/src/modulo.d
Is there a
On 02/03/2016 11:39 PM, Andrea Fontana wrote:
On Wednesday, 3 February 2016 at 17:49:39 UTC, Marc Schütz wrote:
On Wednesday, 3 February 2016 at 16:07:59 UTC, Messenger wrote:
What is a good way to try to force it? Using enum? Then optionally
copying the value once to avoid the "manifest
On 01/17/2016 08:09 PM, data pulverizer wrote:
On Sunday, 17 January 2016 at 02:08:06 UTC, Timon Gehr wrote:
On 01/16/2016 11:50 PM, data pulverizer wrote:
I guess the constraints are that of a static language.
(This is not true.)
Could you please explain?
E.g., a few of the systems
On 01/16/2016 11:50 PM, data pulverizer wrote:
I guess the constraints are that of a static language.
(This is not true.)
On 09/17/2015 09:47 PM, ddos wrote:
yeah i tried for(;;) and it generates the same warning :)
sure, here is the full example, it's not too long anyways
( the example doesn't make much sense tho because socket.accept is
blocking :P )
http://pastebin.com/9K0wRRD6
ps: pastebin needs D support :-D
On 09/04/2015 09:39 PM, Paul wrote:
I discovered the other day (during a cut and paste malfunction!) that
it's possible to have code before the first case in a switch. Google
tells me that it's legal C code and something I read said it could be
used for initialization but was rather vague.
void
On 09/04/2015 11:12 PM, anonymous wrote:
On Friday 04 September 2015 23:04, Timon Gehr wrote:
DMD never warns about dead code.
It warns here:
import std.stdio;
void main()
{
return;
writeln("hi"); /* Warning: statement is not reachable */
}
You are righ
On 08/30/2015 07:02 PM, Spacen Jasset wrote:
I have just added an opDiv to this class, but it doesn't seem to pick it
up.
math/vector.d(30): Error: 'this /= mag' is not a scalar, it is a Vector3
I can't see why that is, becuase my opMul works in the same place. Can
anyone point out what I have
On 08/25/2015 08:29 PM, Vladimir Panteleev wrote:
I think this is a bug, but is easily worked around with:
auto test(string a) {
return .test(a, b);
}
I suspect that the reason the error occurs, is that the auto return type
automatically rewrites the function declaration into an
On 08/26/2015 09:55 PM, Timon Gehr wrote:
On 08/25/2015 08:29 PM, Vladimir Panteleev wrote:
I think this is a bug, but is easily worked around with:
auto test(string a) {
return .test(a, b);
}
I suspect that the reason the error occurs, is that the auto return type
automatically
On 08/20/2015 01:41 AM, Laeeth Isharc wrote:
BTW I don't know why you can't convert a char[] to string - seems
harmless enough conversion that way around.
It would need to allocate a new string, otherwise, one would be able to
modify the contents of the immutable string via the char[]
On 08/20/2015 02:02 AM, Laeeth Isharc wrote:
On Thursday, 20 August 2015 at 00:00:55 UTC, Timon Gehr wrote:
On 08/20/2015 01:41 AM, Laeeth Isharc wrote:
BTW I don't know why you can't convert a char[] to string - seems
harmless enough conversion that way around.
It would need to allocate
On 08/15/2015 01:54 PM, Timon Gehr wrote:
On 08/15/2015 01:25 PM, vladde wrote:
I made a PR to phobos where I modified `std.format.format`.
https://github.com/D-Programming-Language/phobos/pull/3528
However the auto builder fails, with the error message:
runnable/test23.d(1219): Error: cannot
On 08/15/2015 01:25 PM, vladde wrote:
I made a PR to phobos where I modified `std.format.format`.
https://github.com/D-Programming-Language/phobos/pull/3528
However the auto builder fails, with the error message:
runnable/test23.d(1219): Error: cannot implicitly convert expression
(format(s =
On 08/14/2015 05:12 AM, H. S. Teoh via Digitalmars-d-learn wrote:
On Fri, Aug 14, 2015 at 02:42:26AM +, Laeeth Isharc via Digitalmars-d-learn
wrote:
I have a range that is an array of structs. I would like to iterate
through the range, calling a function with the prior k items in the
On 08/14/2015 03:26 PM, Timon Gehr wrote:
On 08/14/2015 05:12 AM, H. S. Teoh via Digitalmars-d-learn wrote:
...
I didn't figure out how to eliminate the short slices toward the end,
...
:o)
...
Less hacky and less efficient:
auto slidingWindow(R)(R range, int k) {
return iota(k).map
On 08/13/2015 06:05 PM, Steven Schveighoffer wrote:
On 8/13/15 11:59 AM, Steven Schveighoffer wrote:
That is definitely a bug. It's because typeid is looking up the derived
type via the vtable, but the compiler should rewrap it with 'shared'
afterwards.
Actually, now that I think about it,
On 08/13/2015 12:17 AM, anonymous wrote:
The following alias declaration is totally legal but actually it's not
usable
---
class Foo
{
void something(size_t param){}
}
class Bar
{
private Foo foo;
this(){foo = new Foo;}
alias somethingelse = foo.something;
}
void
On 08/09/2015 10:13 PM, ixid wrote:
This seems like a reasonable use but errors, obviously I can do it in
many other ways:
ulong[] result = iota(1UL, 10UL).array;
Error: static assert Argument types in (ulong) are not all convertible
to size_t: (ulong)
On 08/07/2015 11:03 AM, Tofu Ninja wrote:
On Friday, 7 August 2015 at 08:18:04 UTC, Nordlöw wrote:
On Friday, 7 August 2015 at 05:21:32 UTC, Tofu Ninja wrote:
HAHAH wow, this is hilarious, I just checked, nothing in std.algo
takes advantage of sorted ranges, sort doesn't even take advantage of
On 07/22/2015 06:29 AM, Taylor Gronka wrote:
Hi,
I have a template function, and I want it to do something if the input
variable is a list of structs, and something else if the input is a struct.
1) What's the best way to test this? I suppose I can call
__traits(identifier, results) and look
On 07/09/2015 05:19 PM, Nordlöw wrote:
Given
extern(C):
struct AVFrame
{
uint8_t*[AV_NUM_DATA_POINTERS] data;
int[AV_NUM_DATA_POINTERS] linesize;
int width, height;
...
}
void av_image_copy(ubyte *[4] dst_data, int[4] dst_linesizes,
On 06/27/2015 12:29 PM, kerdemdemir wrote:
Hi
My question is more about Maths than D lang,
I am hoping, maybe somebody worked with AutoCorrelation function before.
auto autoCorrelation(R)(R range)
if (isRandomAccessRange!R)
{
auto residual = residualPowerOf2(range.length); //
On 06/27/2015 02:17 PM, Timon Gehr wrote:
You then also don't need the final map to extract the real part.
(This is actually not true, your inverseFFT presumably still returns
complex numbers.)
On 06/27/2015 11:54 AM, Marc =?UTF-8?B?U2Now7x0eiI=?=
schue...@gmx.net wrote:
Also are static constructors in templated types guaranteed to run for
every instantiation? Even if the instantiation is never actually used
outside of compile time code, like in an alias or in a UDA?
Definitely
On 06/14/2015 05:50 PM, ketmar wrote:
On Sun, 14 Jun 2015 12:26:52 +, rcorre wrote:
Suppose I have a function defined like so:
void foo(int i) { }
intended to be called like:
5.foo
Should it be labeled with @property?
Or is @property only for true member functions?
only if you plan
On 05/29/2015 06:43 PM, tcak wrote:
I have define an immutable string array:
[code]
immutable string[] placeHolderDefinitionList = [
!-- fullname --,
!-- list item --
];
[/code]
I need to get index of a string at compile time. So I have written a
function as below:
[code]
public
On 05/28/2015 11:27 PM, Adam D. Ruppe wrote:
16 bytes is 64 bit
It's actually 128 bits.
On 05/27/2015 05:30 PM, Steven Schveighoffer wrote:
On 5/27/15 9:11 AM, Simon =?UTF-8?B?QsO8cmdlciI=?=
simon.buer...@rwth-aachen.de wrote:
On Wednesday, 27 May 2015 at 14:58:39 UTC, drug wrote:
Do you want to dynamically change priority?
Actually yes. In my actual code I am not using a
On 05/27/2015 10:09 PM, Meta wrote:
On Wednesday, 27 May 2015 at 19:38:16 UTC, ketmar wrote:
On Wed, 27 May 2015 14:09:47 +, Adam D. Ruppe wrote:
Two options:
1) add an overload that takes typeof(null)
this(typeof(null)) { /* handles the null literal specially */ }
you keep breaking
On 05/23/2015 12:12 AM, Manfred Nowak wrote:
Matt Kline wrote:
isn't making any use of the template argument T
Correct. I do not know how to use `T' to determine the recursion depth of
the template---and I want no further parameter.
-manfred
import std.stdio, std.range, std.algorithm;
On 05/15/2015 11:31 PM, Manfred Nowak wrote:
class C{}
int main(){
void opOpAssign( string op)( C a, C b){
}
C a, b;
a+= b;
}
https://issues.dlang.org/show_bug.cgi?id=8062
On 05/09/2015 05:52 PM, Dennis Ritchie wrote:
On Saturday, 9 May 2015 at 14:15:21 UTC, Ali Çehreli wrote:
On 05/09/2015 04:59 AM, Dennis Ritchie wrote:
On Saturday, 9 May 2015 at 11:49:48 UTC, Timon Gehr wrote:
assert((function int(int
x)=x?x*__traits(parent,{})(x-1):1)(10)==3628800
On 05/09/2015 01:20 PM, Dennis Ritchie wrote:
Hi,
Can lambda functions or delegates in D to call themselves?
Can I write something like this:
-
import std.stdio;
void main() {
auto fact = function (int x) = x * { if (x) fact(x - 1); };
assert(fact(10) == 3628800);
}
On 11/09/2014 11:39 PM, H. S. Teoh via Digitalmars-d-learn wrote:
The original meaning of assert() is what assume() means nowadays,
whereas nowadays what people think of as assert() is actually what
enforce() does in Phobos.
T
No.
On 11/09/2014 05:24 PM, H. S. Teoh via Digitalmars-d-learn wrote:
On Sun, Nov 09, 2014 at 04:12:06PM +, bearophile via Digitalmars-d-learn
wrote:
H. S. Teoh:
Walter *did* mention recently that he was planning to eventually take
advantage of information in assert()'s as optimizer hints.
On 07/19/2014 03:53 PM, Kagamin wrote:
It's ok to deduce opDispatch as pure, but then its purity should be
enforced and error reported.
Why would it be ok to deduce opDispatch as pure only to report an error
that it is not actually pure? This would be a bug as well (albeit none
that causes
On 07/13/2014 01:18 PM, bearophile wrote:
The idea of not making std.algorithm.among!() a predicate was not so good:
...
Agreed.
void main() {
import std.stdio, std.algorithm;
auto s = hello how\nare you;
s.until!(c = c.among!('\n', '\r')).writeln;
}
(A normal workaround is
On 07/13/2014 06:45 PM, Joseph Rushton Wakeling via Digitalmars-d-learn
wrote:
Two consequences of adapting myself to Phobos style were that I realized
(i)how little most of these things really matter, and (ii) pretty much
any stylistic choice carries both benefits and drawbacks.
...
Wrong.
On 07/13/2014 07:51 PM, Brian Rogoff wrote:
On Sunday, 13 July 2014 at 17:24:40 UTC, Timon Gehr wrote:
On 07/13/2014 06:45 PM, Joseph Rushton Wakeling via
Digitalmars-d-learn wrote:
Wrong. There are things which are simply bad ideas.
E.g. in this case, Egyptian-style braces definitely make
1 - 100 of 837 matches
Mail list logo