On Friday, 29 September 2017 at 01:51:36 UTC, Jerry wrote:
[...]
Maybe this?
ref auto at(T : U[], U)(T arr, size_t index) {
return arr[index];
}
int main(string[] argv)
{
int* a = new int(1);
int[] b = [1];
int[1] c = [1];
a.at(0); // won't compile
b.at(0);
As far as I can tell, this code should compile:
class B { int a; }
class D1 : B { int b; }
class D2 : D1 { int c; }
template TupleOf(Classes...)
{
static if(Classes.length > 1)
alias TupleOf = AliasSeq!(Classes[0].tupleof,
TupleOf!(Classes[1..$]));
else static
On Friday, 29 September 2017 at 19:31:14 UTC, Joseph wrote:
I am trying to have a multi-dimensional array and opIndex has
to have both an arbitrary number of parameters and allow for
slicing.
You may want to look into ndslice package source code [1] --Ilya
[1]
On Friday, 29 September 2017 at 09:56:17 UTC, Dukc wrote:
On Friday, 29 September 2017 at 09:12:54 UTC, Don Clugston
wrote:
Guess what this prints
My guess is it prints "1".
By "guess" I mean it, I did not test! Anyway reminds me a lot
of very badly used gotos.
Yeah, it's a lot like
On 28 September 2017 at 11:58, Walter Bright via Digitalmars-d <
digitalmars-d@puremagic.com> wrote:
> On 9/27/2017 4:21 PM, Manu wrote:
>
>> D does not have ADL,
>>
>
> Thank gawd! :-)
>
> which will almost certainly lead to _very_ nasty surprises in behaviour.
>>
>
> ADL was always a hack to
On Friday, 29 September 2017 at 03:37:53 UTC, Jonathan M Davis
wrote:
On Friday, September 29, 2017 01:51:36 Jerry via Digitalmars-d
wrote:
I miss ref variables, for the simple fact that using the
square brackets with a ref variable doesn't access the
pointer. Don't know how many times I've
On Saturday, 30 September 2017 at 01:02:08 UTC, Elronnd wrote:
dmd bla.d bla2.d -shared -fPIC -oflibbla.so
Thanks. I don't normally compile right into a .so, but I think
this is OK:
dmd my_file.o my_other_file.o -shared -of=libutest.so
One thing I picked up from SCons is creating
dmd bla.d bla2.d -shared -fPIC -oflibbla.so
I would like to know that command line (I am on Linux) I would
use to compile a D file and create an object file that is
suitable for a Linux dynamic library (.so).
I believe it is probably
dmd -c -fPIC my_file.d
Also, what is the command line to create a dynamic library from
one or more
On Friday, 29 September 2017 at 02:34:08 UTC, DreadKyller wrote:
On Thursday, 28 September 2017 at 14:01:33 UTC, user1234 wrote:
[...]
I understand that, but because the operator isn't defined
normally for classes unless overloaded, then your statement
about this being an inconsistency on
Have there been any investigations into using region-based memory
management (aka memory arenas) in D, possibly in conjunction with
GC allocated memory? This would be a very speculative idea, but
it'd be interesting to know if there have been looks at this area.
My own interest is
https://issues.dlang.org/show_bug.cgi?id=16995
Walter Bright changed:
What|Removed |Added
Hardware|x86_64 |All
https://issues.dlang.org/show_bug.cgi?id=16995
Walter Bright changed:
What|Removed |Added
CC|
https://issues.dlang.org/show_bug.cgi?id=17085
b2.t...@gmx.com changed:
What|Removed |Added
Status|NEW |RESOLVED
CC|
Well the purpose of the exercise kind of *is* to write a prime
number generator. You can look up prime number sieves and
algorithms. For REALLY large numbers, that takes an insane
amount of time, and you can instead use algorithms such as the
ones outlined at
Hi,
Does Phobos have an isPrime function? I cannot find it in the
library. I currently have a look at projecteuler.net problem no
7. Such a function makes it a lot easier to solve the problem.
https://projecteuler.net/problem=7
Kind regards
Andre
The slides:
https://jll63.github.io/openmethods.d/dlang-meetup-2017-09-28/
Unfortunately, there is no video.
Ali
On 09/18/2017 10:38 PM, Ali Çehreli wrote:
We're excited to be in San Francisco this month:
https://www.meetup.com/D-Lang-Silicon-Valley/events/243022411/
Our host is
On Wednesday, 27 September 2017 at 04:08:39 UTC, Joakim wrote:
On Tuesday, 26 September 2017 at 17:48:06 UTC, Andre Pany wrote:
Hi,
I had set up a cross compilation from Windows to Raspberry Pi
using LDC and GCC toolchain. Almost everything is working
fine. Dub creates a binary which is
https://issues.dlang.org/show_bug.cgi?id=17829
--- Comment #2 from github-bugzi...@puremagic.com ---
Commits pushed to master at https://github.com/dlang/druntime
https://github.com/dlang/druntime/commit/04795c6488943e506150a1da2331cfbcfabb19b1
fix Issue 17829 - core.stdc.errno does not work
On Fri, Sep 29, 2017 at 07:31:14PM +, Joseph via Digitalmars-d-learn wrote:
> I am trying to have a multi-dimensional array and opIndex has to have
> both an arbitrary number of parameters and allow for slicing.
>
> The problem is if I create opIndex for non-slicing, it looks like
>
> ref
On Wednesday, 27 September 2017 at 21:48:35 UTC, timvol wrote:
On Wednesday, 27 September 2017 at 21:44:48 UTC, Ali Çehreli
wrote:
On 09/27/2017 02:39 PM, timvol wrote:
[...]
void main() {
auto mem = new ubyte[1024+15];
auto ptr = cast(ubyte*)(cast(ulong)(mem.ptr + 15) &
~0x0FUL);
On 29.09.2017 17:05, Don Clugston wrote:
I don't see what your proposed grammar change accomplishes:
switch(i){
for(i=8;i<10;++i){
case 7:
writeln(i);
return;
default:{}
}
}
I.e., you seem to have misidentified the culprit. Whether or not to
I am trying to have a multi-dimensional array and opIndex has to
have both an arbitrary number of parameters and allow for slicing.
The problem is if I create opIndex for non-slicing, it looks like
ref auto opIndex(T...)(T index)
and this one catches all templates. But slices do not return
On 9/29/17 2:03 PM, Joseph wrote:
static if ()
{
enum x;
}
static if (isDefined!x)
{
}
What's the correct way to check if a variable has been defined? (note x
may or may not be defined above. I need to know if it is)
Check to see that it has a type:
static if(is(typeof(x)))
{
}
-Steve
On 09/29/2017 11:34 AM, Joseph wrote:
Trying to do multi-dimension array but op-dollar doesn't seem to support
arbitrary dimensions
@property int opDollar(size_t dim : k)() { return dims[k]; }
It's called by multi-dimensional opIndex (or opSlice and perhaps
others?; can be very
On Friday, 29 September 2017 at 18:03:52 UTC, Joseph wrote:
static if ()
{
enum x;
}
static if (isDefined!x)
{
}
What's the correct way to check if a variable has been defined?
(note x may or may not be defined above. I need to know if it
is)
import std.traits;
static if(hasMember!(T,
Trying to do multi-dimension array but op-dollar doesn't seem to
support arbitrary dimensions
@property int opDollar(size_t dim : k)() { return dims[k]; }
static if ()
{
enum x;
}
static if (isDefined!x)
{
}
What's the correct way to check if a variable has been defined?
(note x may or may not be defined above. I need to know if it is)
On Friday, 29 September 2017 at 16:40:38 UTC, Gheorghe Gabriel
wrote:
On Friday, 29 September 2017 at 16:24:32 UTC, bitwise wrote:
On Friday, 29 September 2017 at 11:05:00 UTC, Gheorghe Gabriel
wrote:
[...]
If i compile this script to a .dll
DLL support for D is currently very spotty. Before
On Friday, 29 September 2017 at 16:24:32 UTC, bitwise wrote:
On Friday, 29 September 2017 at 11:05:00 UTC, Gheorghe Gabriel
wrote:
[...]
If i compile this script to a .dll
DLL support for D is currently very spotty. Before investing
too much time, I would suggest confirming that DLLs are
On Fri, Sep 29, 2017 at 12:32:02PM +0200, Timon Gehr via Digitalmars-d wrote:
[...]
> It is very likely that this part of the grammar was deliberately
> copied from C. It's also consistent with how all other control flow
> constructs are parsed.
I believe one of the reasons the grammar was
On Friday, 29 September 2017 at 11:05:00 UTC, Gheorghe Gabriel
wrote:
[...]
If i compile this script to a .dll
DLL support for D is currently very spotty. Before investing too
much time, I would suggest confirming that DLLs are even properly
supported for your target platform at all.
On Friday, 29 September 2017 at 10:32:02 UTC, Timon Gehr wrote:
On 29.09.2017 11:12, Don Clugston wrote:
Guess what this prints
import std.stdio;
void main()
{
int i = 0;
switch (i) for (i = 8; i < 10; ++i)
{
case 7:
writeln(i);
return;
default: ;
On Friday, September 29, 2017 14:34:04 aberba via Digitalmars-d-learn wrote:
> On Friday, 29 September 2017 at 03:42:18 UTC, Jonathan M Davis
>
> wrote:
> > On Friday, September 29, 2017 04:32:44 rikki cattermole via
> >
> > Digitalmars-d- learn wrote:
> >> On 29/09/2017 4:25 AM, Joel wrote:
> >>
On Friday, 29 September 2017 at 03:42:18 UTC, Jonathan M Davis
wrote:
On Friday, September 29, 2017 04:32:44 rikki cattermole via
Digitalmars-d- learn wrote:
On 29/09/2017 4:25 AM, Joel wrote:
> With a given date, I want to know what day it is (like
> Sunday, Monday,
> etc).
>
> I had a look
On Thursday, 28 September 2017 at 11:25:35 UTC, Vadim Lopatin
wrote:
[...]
Fixed.
Awesome, looks perfect now.
Thanks!
On Friday, 29 September 2017 at 07:18:42 UTC, Martin Tschierschke
wrote:
On Wednesday, 27 September 2017 at 12:34:33 UTC, Dmitry wrote:
On Wednesday, 27 September 2017 at 08:00:21 UTC, Traktor Toni
wrote:
[...]
The IDE should contain the compiler for convenience
No.
I think that including
On Friday, 29 September 2017 at 11:20:13 UTC, Cecil Ward wrote:
I love the D >>> operator and I use it a lot. So much safer
than the chaos in C.
I would absolutely love to have unsigned comparison operators
in D. Do you agree? What on earth would the syntax be like?
Yes, I could write a
On Friday, 29 September 2017 at 13:07:32 UTC, Atila Neves wrote:
auto modifiable = foo();
{
const nonModifiable = modifiable;
//...
}
I had already thought about using two names.
I don’t think that using a kind of ‘const-alias’ mechanism (or
‘const reference’, in the C++ var& sense)
On Friday, 29 September 2017 at 11:12:32 UTC, Cecil Ward wrote:
An idea, I’d be interested to hear if this might be at all
useful to anyone -
If and only if a variable is declared as modifiable (neither
immutable nor const), would it possibly be useful to be able to
have a kind of scope
I love the D >>> operator and I use it a lot. So much safer than
the chaos in C.
I would absolutely love to have unsigned comparison operators in
D. Do you agree? What on earth would the syntax be like?
Yes, I could write a generic function or something, but the
result would look ugly. And
An idea, I’d be interested to hear if this might be at all useful
to anyone -
If and only if a variable is declared as modifiable (neither
immutable nor const), would it possibly be useful to be able to
have a kind of scope const on/off switch to either impose const
within a block, and/or
On Friday, 29 September 2017 at 09:34:26 UTC, JN wrote:
On Wednesday, 27 September 2017 at 20:03:27 UTC, Gheorghe
Gabriel wrote:
Hi,
I have a 3D scene editor.
I need my scripts to be dynamically loaded in the scene.
In c# or java I can use reflections to do that.
How can I do that with D?
I
On 29.09.2017 11:12, Don Clugston wrote:
Guess what this prints
import std.stdio;
void main()
{
int i = 0;
switch (i) for (i = 8; i < 10; ++i)
{
case 7:
writeln(i);
return;
default: ;
}
}
Why does this even compile? It's because the grammar
On Friday, 29 September 2017 at 09:12:54 UTC, Don Clugston wrote:
Guess what this prints
My guess is it prints "1".
By "guess" I mean it, I did not test! Anyway reminds me a lot of
very badly used gotos.
On Wednesday, 27 September 2017 at 20:03:27 UTC, Gheorghe Gabriel
wrote:
Hi,
I have a 3D scene editor.
I need my scripts to be dynamically loaded in the scene.
In c# or java I can use reflections to do that.
How can I do that with D?
I know that std.traits only works in compile time.
Please,
Guess what this prints
import std.stdio;
void main()
{
int i = 0;
switch (i) for (i = 8; i < 10; ++i)
{
case 7:
writeln(i);
return;
default: ;
}
}
Why does this even compile? It's because the grammar is:
SwitchStatement:
switch ( Expression )
On Friday, 29 September 2017 at 01:51:36 UTC, Jerry wrote:
Don't know how many times I've accidentially used a pointer as
an array.
Using @safe let's the compiler to catch that. Well, in it you
can't use pointer arithmetic even explicitly, but if you have
many elements to point at you're
https://issues.dlang.org/show_bug.cgi?id=15531
Heromyth changed:
What|Removed |Added
CC||bitwo...@qq.com
--- Comment #2
On Wednesday, 27 September 2017 at 12:34:33 UTC, Dmitry wrote:
On Wednesday, 27 September 2017 at 08:00:21 UTC, Traktor Toni
wrote:
[...]
The IDE should contain the compiler for convenience
No.
I think that including DMD & Co. into DlangIde is not the right
approach,
but offering one D-NOW
On Friday, 29 September 2017 at 06:32:19 UTC, rikki cattermole
wrote:
On 29/09/2017 7:29 AM, Joel wrote:
How do I count the days between to dates?
https://dlang.org/phobos/std_datetime_date.html#.Date.opBinary.2
https://dlang.org/phobos/core_time.html#.Duration.total
Thanks rikki. I did
On 29/09/2017 7:29 AM, Joel wrote:
How do I count the days between to dates?
https://dlang.org/phobos/std_datetime_date.html#.Date.opBinary.2
https://dlang.org/phobos/core_time.html#.Duration.total
How do I count the days between to dates?
53 matches
Mail list logo