On Wednesday, 13 July 2016 at 03:38:03 UTC, Mike Parker wrote:
On Wednesday, 13 July 2016 at 02:49:54 UTC, Adam Sansier wrote:
On Wednesday, 13 July 2016 at 02:34:14 UTC, Mike Parker wrote:
What happens when you declare an interface that extends from
IUnknown (and not extern(C++)), then cast
On Wednesday, 13 July 2016 at 02:49:54 UTC, Adam Sansier wrote:
On Wednesday, 13 July 2016 at 02:34:14 UTC, Mike Parker wrote:
What happens when you declare an interface that extends from
IUnknown (and not extern(C++)), then cast the pointer returned
from the COM API? It should just work with
On Wednesday, 13 July 2016 at 02:29:12 UTC, Jesse Phillips wrote:
On Tuesday, 12 July 2016 at 05:16:30 UTC, Adam Sansier wrote:
windows libs have a lot of structs and it would be nice to
have the ability to convert them to a string to see them in
the debugger(e.g., CLSID).
Is there a way to d
On Wednesday, 13 July 2016 at 02:34:14 UTC, Mike Parker wrote:
On Tuesday, 12 July 2016 at 23:55:55 UTC, Adam Sansier wrote:
Ok, Another hack:
iInterface x;
void** y = cast(void**)&x;
*y = malloc(iInterface.sizeof);
On Wednesday, 13 July 2016 at 02:25:35 UTC, Jesse Phillips wrote:
On Tuesday, 12 July 2016 at 15:09:26 UTC, Adam Sansier wrote:
So, com throughs me a interface ptr and I need to map it to an
interface. When I do, I get an access violation.
I have an (com) ptr and an interface. How do I link th
On Thursday, 30 January 2014 at 03:28:57 UTC, Craig Dillabaugh
wrote:
So, there is a module core.stdc.config (referenced here):
http://dlang.org/interfaceToC.html
That is presumably part of the D Standard library. I am
curious to know why no mention of this library is included at:
http://dl
On Tuesday, 12 July 2016 at 23:55:55 UTC, Adam Sansier wrote:
Ok, Another hack:
iInterface x;
void** y = cast(void**)&x;
*y = malloc(iInterface.sizeof);
x.__vptr = cast(immutable(void*)*)(*ptr);
x.
On Tuesday, 12 July 2016 at 15:09:26 UTC, Adam Sansier wrote:
So, com throughs me a interface ptr and I need to map it to an
interface. When I do, I get an access violation.
I have an (com) ptr and an interface. How do I link them up so
I can call the functions?
I marked the interface extern
On Tuesday, 12 July 2016 at 05:16:30 UTC, Adam Sansier wrote:
windows libs have a lot of structs and it would be nice to have
the ability to convert them to a string to see them in the
debugger(e.g., CLSID).
Is there a way to do this? I've tried to pull out the code from
the libs but it if a
On Tuesday, 12 July 2016 at 14:04:55 UTC, Seb wrote:
D is entirely driven by highly motivated volunteers. (this will
change soon with the new D foundation)
With the fundation, volunteers wont be highly motivated anymore.
Fundations are real motivation-killers.
On 07/12/2016 03:54 PM, H. S. Teoh via Digitalmars-d-learn wrote:
On Tue, Jul 12, 2016 at 03:40:36PM -0700, Charles Hixson via
Digitalmars-d-learn wrote:
[...]
OK. It's not possible without OS support. Agreed. And I don't want
to get into C calls, but rather to use the mechanisms that D prov
On Friday, 13 February 2015 at 21:08:58 UTC, Marc Schütz wrote:
On Friday, 13 February 2015 at 19:09:43 UTC, Tobias Pankrath
wrote:
1. Throw preallocated exceptions is the way to go
... and because noone has yet shown an explicit example:
void myThrowingNogcFunc() @nogc {
static c
On Tuesday, 12 July 2016 at 22:55:05 UTC, Adam Sansier wrote:
So, the problem now, is how to take the interface, which is
simple, no implementation, and either create the
implementation or create a sort of simple empty proxy that can
be used to instantiate the interface?
I mean automaticall
On Tuesday, 12 July 2016 at 14:04:55 UTC, Seb wrote:
D is entirely driven by highly motivated volunteers. (this will
change soon with the new D foundation)
I for one welcome our new D Foundation overlords.
On Tue, Jul 12, 2016 at 03:40:36PM -0700, Charles Hixson via
Digitalmars-d-learn wrote:
[...]
> OK. It's not possible without OS support. Agreed. And I don't want
> to get into C calls, but rather to use the mechanisms that D provides.
> And this *probably* won't cause any problems. But how sh
So, the problem now, is how to take the interface, which is
simple, no implementation, and either create the implementation
or create a sort of simple empty proxy that can be used to
instantiate the interface?
I mean automatically of course. I believe D already has some
library solution for
On Tuesday, 12 July 2016 at 22:01:41 UTC, Lodovico Giaretta wrote:
On Tuesday, 12 July 2016 at 21:21:04 UTC, Adam Sansier wrote:
On Tuesday, 12 July 2016 at 15:12:21 UTC, Lodovico Giaretta
wrote:
I'm not an expert in this field, but did you read this[1]?
[1] https://dlang.org/spec/interface.h
On 07/12/2016 12:05 PM, H. S. Teoh via Digitalmars-d-learn wrote:
On Tue, Jul 12, 2016 at 11:54:18AM -0700, Charles Hixson via
Digitalmars-d-learn wrote:
I want to open a file with an exclusive lock. It would be important
that no other thread be able to access the file in write mode, and
desir
On Tuesday, 12 July 2016 at 21:21:04 UTC, Adam Sansier wrote:
On Tuesday, 12 July 2016 at 15:12:21 UTC, Lodovico Giaretta
wrote:
I'm not an expert in this field, but did you read this[1]?
[1] https://dlang.org/spec/interface.html#com-interfaces
Yes, of course...
Well, I asked because you s
On Tuesday, 12 July 2016 at 15:13:02 UTC, Adam D. Ruppe wrote:
On Tuesday, 12 July 2016 at 15:09:26 UTC, Adam Sansier wrote:
I marked the interface extern(C++) so it's a C++ style
interface.
The first field of a COM object is a pointer to its vtable.
If it is a COM interface, you should make
On Tuesday, 12 July 2016 at 15:12:21 UTC, Lodovico Giaretta wrote:
On Tuesday, 12 July 2016 at 15:09:26 UTC, Adam Sansier wrote:
So, com throughs me a interface ptr and I need to map it to an
interface. When I do, I get an access violation.
I have an (com) ptr and an interface. How do I link t
On Tuesday, 12 July 2016 at 18:52:08 UTC, Meta wrote:
On Tuesday, 12 July 2016 at 04:23:07 UTC, Adam Sansier wrote:
Now, I could simply make Do a template method but then this
prevents it being a virtual function.
void Do(T)(T name) if (is(T == string) || is(T == int))
{
Init_Data();
On Tuesday, 12 July 2016 at 17:17:31 UTC, Kagamin wrote:
On Tuesday, 12 July 2016 at 16:30:05 UTC, Adam Sansier wrote:
Doesn't matter, it's not what I asked.
Yeah, I'm not confident I understood your problem right. You
can try to describe your problem better.
Criteria:
1. At most 2 one par
On Tue, Jul 12, 2016 at 11:54:18AM -0700, Charles Hixson via
Digitalmars-d-learn wrote:
> I want to open a file with an exclusive lock. It would be important
> that no other thread be able to access the file in write mode, and
> desirable that no other thread be able to access the file in read
>
On Tuesday, 12 July 2016 at 18:54:18 UTC, Charles Hixson wrote:
I want to open a file with an exclusive lock. It would be
important that no other thread be able to access the file in
write mode, and desirable that no other thread be able to
access the file in read mode. (Ditto for other proce
On Tuesday, 12 July 2016 at 18:52:08 UTC, Meta wrote:
On Tuesday, 12 July 2016 at 04:23:07 UTC, Adam Sansier wrote:
Now, I could simply make Do a template method but then this
prevents it being a virtual function.
void Do(T)(T name) if (is(T == string) || is(T == int))
{
Init_Data();
On Tuesday, 12 July 2016 at 04:23:07 UTC, Adam Sansier wrote:
Now, I could simply make Do a template method but then this
prevents it being a virtual function.
void Do(T)(T name) if (is(T == string) || is(T == int))
{
Init_Data();
static if (is(T == string))
{
...Get index
I want to open a file with an exclusive lock. It would be important
that no other thread be able to access the file in write mode, and
desirable that no other thread be able to access the file in read mode.
(Ditto for other processes.)
stdio.file.lock (or is it stdio.file.File.lock?) seems t
On Tuesday, 12 July 2016 at 08:34:03 UTC, Kagamin wrote:
Store a wrapper instead of the actual function:
void wrapper(alias F)(string[] args)
{
(convert args to F arguments) and invoke
}
cmd.func = &wrapper!someFunc;
string[] args;
cmd.func(args);
Thanks that is clever. Never would have tho
On Tuesday, 12 July 2016 at 16:30:05 UTC, Adam Sansier wrote:
Doesn't matter, it's not what I asked.
Yeah, I'm not confident I understood your problem right. You can
try to describe your problem better.
On Tuesday, 12 July 2016 at 16:42:52 UTC, Lodovico Giaretta wrote:
On Tuesday, 12 July 2016 at 16:30:05 UTC, Adam Sansier wrote:
Doesn't matter, it's not what I asked. Trying to provide
answers to a question that wasn't asked and was clearly stated
I wasn't interested in those types of answers.
On Tuesday, 12 July 2016 at 16:27:52 UTC, Adam Sansier wrote:
On Tuesday, 12 July 2016 at 13:54:16 UTC, Lodovico Giaretta
Also note that yield semantics as available in various
languages is much different from what you are proposing here.
Not really. Yield is usually a break in flow, regardles
On Tuesday, 12 July 2016 at 16:45:18 UTC, DLearner wrote:
General/Issues/or...
P.R. to this repository: https://github.com/dlang/DIPs
General/Issues/or...
On Tuesday, 12 July 2016 at 16:30:05 UTC, Adam Sansier wrote:
Doesn't matter, it's not what I asked. Trying to provide
answers to a question that wasn't asked and was clearly stated
I wasn't interested in those types of answers.
Every language has its own ways of solving various problems.
We a
On Tuesday, 12 July 2016 at 16:03:15 UTC, Kagamin wrote:
On Tuesday, 12 July 2016 at 13:44:02 UTC, Adam Sansier wrote:
I don't like it, creates an extra function for no apparent
reason except to get around the problem of not having a yield
type of semantic. Again, I wasn't asking for any ol' so
On Tuesday, 12 July 2016 at 13:54:16 UTC, Lodovico Giaretta wrote:
On Tuesday, 12 July 2016 at 13:44:02 UTC, Adam Sansier wrote:
On Tuesday, 12 July 2016 at 08:52:26 UTC, Kagamin wrote:
Extract functions for shared parts:
void Do(string name)
{
DoStuff();
int i = find(name);
DoStuf
On Tuesday, 12 July 2016 at 13:44:02 UTC, Adam Sansier wrote:
I don't like it, creates an extra function for no apparent
reason except to get around the problem of not having a yield
type of semantic. Again, I wasn't asking for any ol' solution,
there are many ways to skin this cat.
It's a no
On Tuesday, 12 July 2016 at 14:51:43 UTC, Adam Sansier wrote:
On Tuesday, 12 July 2016 at 14:27:49 UTC, Adam D. Ruppe wrote:
On Tuesday, 12 July 2016 at 05:16:30 UTC, Adam Sansier wrote:
Is there a way to do this?
write a new function that prints them and call that
This doesn't work to disp
On Tuesday, 12 July 2016 at 14:42:23 UTC, ag0aep6g wrote:
On 07/12/2016 04:04 PM, Seb wrote:
D is entirely driven by
highly motivated volunteers. (this will change soon with the
new D
foundation)
Does the foundation have plans to hire programmers? That's news
to me.
At the DConf16 Andrei
On Tuesday, 12 July 2016 at 15:08:29 UTC, Adam D. Ruppe wrote:
On Tuesday, 12 July 2016 at 14:54:25 UTC, Adam Sansier wrote:
Um, because that's the way they were defined! So your telling
me that D is going to make me mark every member align(n) when
C++ has a global pragma align that does it for
On Tuesday, 12 July 2016 at 15:09:26 UTC, Adam Sansier wrote:
I marked the interface extern(C++) so it's a C++ style
interface.
The first field of a COM object is a pointer to its vtable.
If it is a COM interface, you should make it a COM interface by
inheriting from IUnknown.
http://dlang
On Tuesday, 12 July 2016 at 15:09:26 UTC, Adam Sansier wrote:
So, com throughs me a interface ptr and I need to map it to an
interface. When I do, I get an access violation.
I have an (com) ptr and an interface. How do I link them up so
I can call the functions?
I marked the interface extern
So, com throughs me a interface ptr and I need to map it to an
interface. When I do, I get an access violation.
I have an (com) ptr and an interface. How do I link them up so I
can call the functions?
I marked the interface extern(C++) so it's a C++ style interface.
The first field of a COM
On Tuesday, 12 July 2016 at 14:54:25 UTC, Adam Sansier wrote:
Um, because that's the way they were defined! So your telling
me that D is going to make me mark every member align(n) when
C++ has a global pragma align that does it for all in the scope?
This is trivial, just add it to the binding
On Tuesday, 12 July 2016 at 14:26:54 UTC, Adam D. Ruppe wrote:
On Tuesday, 12 July 2016 at 00:20:31 UTC, Adam Sansier wrote:
I need to align every member of every struct in a module. I
can't simply add align(n) inside every struct because that
seems ridiculous.
Why are these structs needing t
On Tuesday, 12 July 2016 at 14:27:49 UTC, Adam D. Ruppe wrote:
On Tuesday, 12 July 2016 at 05:16:30 UTC, Adam Sansier wrote:
Is there a way to do this?
write a new function that prints them and call that
This doesn't work to display them in visual D though. Requires a
lot of hoops just to s
On 07/12/2016 04:04 PM, Seb wrote:
D is entirely driven by
highly motivated volunteers. (this will change soon with the new D
foundation)
Does the foundation have plans to hire programmers? That's news to me.
On Tuesday, 12 July 2016 at 05:16:30 UTC, Adam Sansier wrote:
Is there a way to do this?
write a new function that prints them and call that
On Tuesday, 12 July 2016 at 00:20:31 UTC, Adam Sansier wrote:
I need to align every member of every struct in a module. I
can't simply add align(n) inside every struct because that
seems ridiculous.
Why are these structs needing the alignment?
From what I've read, align(n){ struct x; } only a
On Tuesday, 12 July 2016 at 00:17:32 UTC, Adam Sansier wrote:
On Monday, 11 July 2016 at 15:54:02 UTC, Seb wrote:
On Monday, 11 July 2016 at 01:59:51 UTC, Adam Sansier wrote:
On Monday, 11 July 2016 at 01:58:23 UTC, Adam Sansier wrote:
I'm using some win functions that don't use the gc and are
On Tuesday, 12 July 2016 at 13:56:49 UTC, cym13 wrote:
I'm with Steven here, that's definitely too surprising,
initialization should not be linked to clear in any way.
feel free to change/improve it. for me it is logical, but i'm
often found that i am the only one who agrees with my logic. ;-)
On Tuesday, 12 July 2016 at 13:01:20 UTC, ketmar wrote:
On Tuesday, 12 July 2016 at 12:34:40 UTC, Steven Schveighoffer
wrote:
There was a suggestion to make .clear (a relatively new
feature) actually preallocate if it's currently null, but I
didn't want to do allocating in that method (too surp
On Tue, Jul 12, 2016 at 06:37:35AM +, Mike Parker via Digitalmars-d-learn
wrote:
> On Tuesday, 12 July 2016 at 03:57:09 UTC, Bahman Movaqar wrote:
> > What should be signature of `foo` in the following piece of code?
> >
> > auto foo(range r) {
> > // do something with the `r`
> >
On Tuesday, 12 July 2016 at 13:44:02 UTC, Adam Sansier wrote:
On Tuesday, 12 July 2016 at 08:52:26 UTC, Kagamin wrote:
Extract functions for shared parts:
void Do(string name)
{
DoStuff();
int i = find(name);
DoStuffWithIndex(i);
}
void Do(int name)
{
DoStuff();
DoStuffWith
On Tuesday, 12 July 2016 at 08:52:26 UTC, Kagamin wrote:
Extract functions for shared parts:
void Do(string name)
{
DoStuff();
int i = find(name);
DoStuffWithIndex(i);
}
void Do(int name)
{
DoStuff();
DoStuffWithIndex(i);
}
I don't like it, creates an extra function for no
On Tuesday, 12 July 2016 at 12:34:40 UTC, Steven Schveighoffer
wrote:
There was a suggestion to make .clear (a relatively new
feature) actually preallocate if it's currently null, but I
didn't want to do allocating in that method (too surprising). I
do think it would be nice to have an initiali
On 7/12/16 5:42 AM, ketmar wrote:
On Tuesday, 12 July 2016 at 03:38:44 UTC, Bahman Movaqar wrote:
Now I understand.
This is tricky --could introduce hard to find bugs. Is there anyway to
make sure it doesn't happen? Such as giving the AA a default empty
value on the declaration line --like `st
On 7/12/16 1:31 AM, Chang Long wrote:
On Tuesday, 12 July 2016 at 04:38:42 UTC, Chang Long wrote:
test.d
=
template newType(size_t N){
class NewType
{
enum Type = N ;
}
}
just find it should be this:
template newType(size_t N){
cl
On 7/12/16 1:05 AM, WhatMeWorry wrote:
On Monday, 11 July 2016 at 19:07:51 UTC, ketmar wrote:
list slices are not random-access ranges, thus they can't be sorted
in-place (this is what std.algorithm.sort does). so the only way is to
convert list to array, sort it, and make a list from sorted arr
On 07/12/2016 04:21 PM, Edwin van Leeuwen wrote:
> On Tuesday, 12 July 2016 at 11:40:48 UTC, Bahman Movaqar wrote:
>> On 07/12/2016 01:01 PM, Mike Parker wrote:
>>> Do you have some sample code that shows the error?
>>
>> Yes. I'm working on Stockman[1] a playground to learn D.
>> In file `etl.d`,
On Tuesday, 12 July 2016 at 11:26:20 UTC, jj75607 wrote:
you can't. there is no AST macros in D, so you can't rewrite
parsed source.
On 07/12/2016 04:23 PM, ag0aep6g wrote:
> On 07/12/2016 01:40 PM, Bahman Movaqar wrote:
>> Yes. I'm working on Stockman[1] a playground to learn D.
>> In file `etl.d`, line 110 [2], if I change the line to
>> auto refInvoice = group[1].takeOne();
>> the file will not compile. I have attached
On 07/12/2016 01:40 PM, Bahman Movaqar wrote:
Yes. I'm working on Stockman[1] a playground to learn D.
In file `etl.d`, line 110 [2], if I change the line to
auto refInvoice = group[1].takeOne();
the file will not compile. I have attached the compile error to this
message.
Do you also ad
On Tuesday, 12 July 2016 at 11:40:48 UTC, Bahman Movaqar wrote:
On 07/12/2016 01:01 PM, Mike Parker wrote:
Do you have some sample code that shows the error?
Yes. I'm working on Stockman[1] a playground to learn D.
In file `etl.d`, line 110 [2], if I change the line to
auto refInvoice = g
On 07/12/2016 01:01 PM, Mike Parker wrote:
> Do you have some sample code that shows the error?
Yes. I'm working on Stockman[1] a playground to learn D.
In file `etl.d`, line 110 [2], if I change the line to
auto refInvoice = group[1].takeOne();
the file will not compile. I have attached the
On Tuesday, 12 July 2016 at 11:26:20 UTC, jj75607 wrote:
I want to use aspect-like annotations to transform
@Lockable
class Abc
{
@sync
void f() {
writeln("f");
}
@shared
void g() {
writeln("g");
}
}
to something like:
class Ab
I want to use aspect-like annotations to transform
@Lockable
class Abc
{
@sync
void f() {
writeln("f");
}
@shared
void g() {
writeln("g");
}
}
to something like:
class Abc
{
shared(ReadWriteMutex) _lock123;
this()
On Sunday, 10 July 2016 at 07:20:29 UTC, Meta wrote:
On Friday, 8 July 2016 at 09:01:10 UTC, Marc Schütz wrote:
`foo()` is effectively a delegate, therefore `const` applies
to the context.
AFAIK const on a function can only ever refer to the `this`
pointer, but there is no `this` pointer.
T
On Tuesday, 12 July 2016 at 09:17:37 UTC, ag0aep6g wrote:
On 07/12/2016 11:09 AM, Dsby wrote:
How can i call @system function in a @safe function?
You can't. You can mark the @safe function @trusted [1]
instead. @trusted functions are considered memory-safe by the
compiler and can be called
On Tuesday, 12 July 2016 at 03:38:44 UTC, Bahman Movaqar wrote:
Now I understand.
This is tricky --could introduce hard to find bugs. Is there
anyway to
make sure it doesn't happen? Such as giving the AA a default
empty
value on the declaration line --like `string[int] a = []`?
no. the onl
On 07/12/2016 11:09 AM, Dsby wrote:
How can i call @system function in a @safe function?
You can't. You can mark the @safe function @trusted [1] instead.
@trusted functions are considered memory-safe by the compiler and can be
called from @safe code, but they can use @system features and call
How can i call @system function in a @safe function?
Extract functions for shared parts:
void Do(string name)
{
DoStuff();
int i = find(name);
DoStuffWithIndex(i);
}
void Do(int name)
{
DoStuff();
DoStuffWithIndex(i);
}
Store a wrapper instead of the actual function:
void wrapper(alias F)(string[] args)
{
(convert args to F arguments) and invoke
}
cmd.func = &wrapper!someFunc;
string[] args;
cmd.func(args);
On Tuesday, 12 July 2016 at 07:50:34 UTC, Bahman Movaqar wrote:
On 07/12/2016 11:07 AM, Mike Parker wrote:
auto foo(R)(R r) { ... }
That did it. Thanks.
Out of curiosity, does the same pattern apply to functions
which take
`tuple`s as input arguments?
It's just a function template. It's w
On Tuesday, 12 July 2016 at 08:03:53 UTC, Bahman Movaqar wrote:
On 07/12/2016 11:06 AM, Mike Parker wrote:
The 'Group' type is an implementation detail -- a type used
internally -- that you aren't supposed to care about. All you
need to care about is that it's a range. The documentation for
ch
On 07/12/2016 11:06 AM, Mike Parker wrote:
> The 'Group' type is an implementation detail -- a type used internally
> -- that you aren't supposed to care about. All you need to care about is
> that it's a range. The documentation for chunkBy [1] explains what the
> return type is.
>
> [1] https://
On 07/12/2016 11:07 AM, Mike Parker wrote:
> auto foo(R)(R r) { ... }
That did it. Thanks.
Out of curiosity, does the same pattern apply to functions which take
`tuple`s as input arguments?
--
Bahman
79 matches
Mail list logo