On Friday, 12 August 2016 at 04:49:46 UTC, Charles Hixson wrote:
It works, it's just not the syntax that I'd prefer. And it
leaves me wondering exactly what
immutable class Msg {...}
was declaring.
This should demonstrate:
```
immutable class iMsg {
int getX() { return 10; }
}
class Ms
On 08/11/2016 06:33 PM, Mike Parker via Digitalmars-d-learn wrote:
On Friday, 12 August 2016 at 00:44:31 UTC, Charles Hixson wrote:
A way around this, which may be the same as the approach used by
string was:
alias immutable(Msg_)Msg;
classMsg_
{ ...
This is exactly what Jonathan s
On Friday, 12 August 2016 at 03:41:54 UTC, bachmeier wrote:
On Friday, 12 August 2016 at 03:31:37 UTC, ketmar wrote:
On Friday, 12 August 2016 at 03:20:59 UTC, grampus wrote:
Didn't realise the D community is such active.
yes, we are. while we may be not very huge in number, we are
very pass
On Friday, 12 August 2016 at 03:31:37 UTC, ketmar wrote:
On Friday, 12 August 2016 at 03:20:59 UTC, grampus wrote:
Didn't realise the D community is such active.
yes, we are. while we may be not very huge in number, we are
very passionate about our language of choice. ;-)
Currently there ar
On Friday, 12 August 2016 at 03:20:59 UTC, grampus wrote:
Didn't realise the D community is such active.
yes, we are. while we may be not very huge in number, we are very
passionate about our language of choice. ;-)
On Friday, 12 August 2016 at 02:31:29 UTC, ketmar wrote:
On Friday, 12 August 2016 at 01:36:34 UTC, grampus wrote:
[...]
then you have to check if runtime is initialized at the start
of each function that can be called from C side. like this:
[...]
Understand, I will be careful here.
Than
On Friday, 12 August 2016 at 01:36:34 UTC, grampus wrote:
I can use dlang in this existing project as long as nothing can
be changed on the C side.
then you have to check if runtime is initialized at the start of
each function that can be called from C side. like this:
private void ensureRu
On Thursday, 11 August 2016 at 21:25:20 UTC, sldkf wrote:
On Thursday, 11 August 2016 at 20:27:01 UTC, Engine Machine
wrote:
This requires F2 to know the future. It also forces it to use
a specific bar. I want inheritance like logic.
You are goind to hit a wall. Template programming is not OOP
On Friday, 12 August 2016 at 01:45:29 UTC, Mike Parker wrote:
On Friday, 12 August 2016 at 01:36:34 UTC, grampus wrote:
On Friday, 12 August 2016 at 01:09:47 UTC, ketmar wrote:
On Friday, 12 August 2016 at 00:57:42 UTC, grampus wrote:
it's 'cause you didn't initialized druntime. you have to us
On Thursday, 11 August 2016 at 21:03:36 UTC, Ali Çehreli wrote:
On 08/11/2016 01:27 PM, Engine Machine wrote:
> I see the mixin as a sort of copy and paste.
That's the case for string mixins. Template mixins bring a name
resolution scope. My understanding of the topic:
http://ddili.org/de
On Friday, 12 August 2016 at 01:36:34 UTC, grampus wrote:
On Friday, 12 August 2016 at 01:09:47 UTC, ketmar wrote:
On Friday, 12 August 2016 at 00:57:42 UTC, grampus wrote:
it's 'cause you didn't initialized druntime. you have to use
dlsym to get "rt_init" function and call it right after
loa
On Friday, 12 August 2016 at 00:57:42 UTC, grampus wrote:
Hi,erveryone
I am trying to use dLang to make so file for existing c/c++
project.
I followed the examples on https://dlang.org/dll-linux.html,
which works well.
but when I replaced import core.stdc.stdio; with import
std.stdio;
to us
On Friday, 12 August 2016 at 01:09:47 UTC, ketmar wrote:
On Friday, 12 August 2016 at 00:57:42 UTC, grampus wrote:
it's 'cause you didn't initialized druntime. you have to use
dlsym to get "rt_init" function and call it right after loading
your .so, but before calling any other API from it.
On Friday, 12 August 2016 at 00:44:31 UTC, Charles Hixson wrote:
A way around this, which may be the same as the approach used
by string was:
alias immutable(Msg_)Msg;
classMsg_
{ ...
This is exactly what Jonathan suggested in the post above. And
yes, it's how string is handled:
On Friday, 12 August 2016 at 00:57:42 UTC, grampus wrote:
it's 'cause you didn't initialized druntime. you have to use
dlsym to get "rt_init" function and call it right after loading
your .so, but before calling any other API from it.
also, note that druntime is using SIGUSR1 and SIGUSR2 for
Hi,erveryone
I am trying to use dLang to make so file for existing c/c++
project.
I followed the examples on https://dlang.org/dll-linux.html,
which works well.
but when I replaced import core.stdc.stdio; with import std.stdio;
to use writefln() instead of printf(), then things changed.
compi
A way around this, which may be the same as the approach used by string was:
alias immutable(Msg_)Msg;
classMsg_
{ ...
This so far appears to do what I want. The only problem is that it
introduces an extraneous symbol, which I would prefer to avoid.
OTOH, I did fix a few problems be
On Thursday, 11 August 2016 at 20:27:01 UTC, Engine Machine wrote:
This requires F2 to know the future. It also forces it to use a
specific bar. I want inheritance like logic.
You are goind to hit a wall. Template programming is not OOP.
I'm not even sure that reflection would work in order to
On Thursday, 11 August 2016 at 20:27:51 UTC, Michael Coulombe
wrote:
here is something for you to play with:
import std.stdio;
enum CallAllowed0;
enum CallAllowed1;
struct S {
@CallAllowed0 void foo () { writeln("foo()"); }
@CallAllowed1 void foo (int n) { writeln("foo(", n, ")"); }
}
On 08/11/2016 01:27 PM, Engine Machine wrote:
> I see the mixin as a sort of copy and paste.
That's the case for string mixins. Template mixins bring a name
resolution scope. My understanding of the topic:
http://ddili.org/ders/d.en/mixin.html#ix_mixin.name%20space,%20mixin
The spec:
ht
On Thursday, 11 August 2016 at 18:11:30 UTC, Engine Machine wrote:
I have the need, in some cases, to pass static information to a
template class but don't want it to affect its type.
import std.algorithm, core.stdc.stdlib;
struct X(int defaultSize = 100)
{
int Size;
int* p;
void foo(i
On Thursday, 11 August 2016 at 20:41:33 UTC, ketmar wrote:
ah, my bad, i missed UDA part of the question. sorry. ;-)
On Thursday, 11 August 2016 at 20:27:51 UTC, Michael Coulombe
wrote:
import std.stdio;
struct S {
void foo () { writeln("foo()"); }
void foo (int n) { writeln("foo(", n, ")"); }
}
auto doit(string methodName, C, Args...) (C c, Args args) {
static if (is(typeof(mixin("c."~methodName~"(a
On 8/11/16 4:15 PM, Engine Machine wrote:
On Thursday, 11 August 2016 at 18:42:51 UTC, Steven Schveighoffer wrote:
On 8/11/16 2:11 PM, Engine Machine wrote:
I have the need, in some cases, to pass static information to a template
class but don't want it to affect its type.
import std.algorithm
On Thursday, 11 August 2016 at 20:27:51 UTC, Michael Coulombe
wrote:
Is there a way to implement "getSymbolOfCall" and
"getDelegateOfCall" such that doit is functionally equivalent
to calling the method directly?
auto doit(C, string methodName, Args...)(C c, Args args) {
alias methodSymbol
Is there a way to implement "getSymbolOfCall" and
"getDelegateOfCall" such that doit is functionally equivalent to
calling the method directly?
auto doit(C, string methodName, Args...)(C c, Args args) {
alias methodSymbol = getSymbolOfCall!(c, methodName, Args);
pragma(msg, hasUDA!(meth
On Thursday, 11 August 2016 at 19:05:58 UTC, sldkf wrote:
On Thursday, 11 August 2016 at 17:56:47 UTC, Engine Machine
wrote:
template F1(T)
{
void bar() { writeln("Bar0"); }
}
template F2(T)
{
mixin F1!T;
void foo() { bar(); }
}
template F3(T)
{
mixin F2!T;
void bar() { writeln(
On Thursday, 11 August 2016 at 18:42:51 UTC, Steven Schveighoffer
wrote:
On 8/11/16 2:11 PM, Engine Machine wrote:
I have the need, in some cases, to pass static information to
a template
class but don't want it to affect its type.
import std.algorithm, core.stdc.stdlib;
struct X(int defaultSi
Also, what if we use a class instead of a struct?
in this case they are both references to the same thing.
I see a problem with reflection though, as one could get the
template parameter value and it would wrong on conversion. D
takes the easy way out of just preventing complex and potentially
On Thursday, 11 August 2016 at 19:28:47 UTC, Lodovico Giaretta
wrote:
On Thursday, 11 August 2016 at 18:11:30 UTC, Engine Machine
wrote:
[...]
If, in your case, it is possible to use one type as the other,
then specify it.
I mean, implement a templated opAssign that allows you to
assign valu
On Thursday, August 11, 2016 10:56:59 Charles Hixson via Digitalmars-d-learn
wrote:
> I want to declare a class all instances of which will be immutable, and
> all references to which will be inherently immutable (so that I don't
> need to slip a huge number of "immutable" statements in my code).
On Thursday, 11 August 2016 at 18:11:30 UTC, Engine Machine wrote:
[...]
If, in your case, it is possible to use one type as the other,
then specify it.
I mean, implement a templated opAssign that allows you to assign
values of one instantiation to values of another. While doing so,
remember
On Thursday, 11 August 2016 at 17:56:47 UTC, Engine Machine wrote:
template F1(T)
{
void bar() { writeln("Bar0"); }
}
template F2(T)
{
mixin F1!T;
void foo() { bar(); }
}
template F3(T)
{
mixin F2!T;
void bar() { writeln("Bar1"); } // <- This bar should be
used for F2's foo!
}
On 8/11/16 2:42 PM, Steven Schveighoffer wrote:
On 8/11/16 2:11 PM, Engine Machine wrote:
I have the need, in some cases, to pass static information to a template
class but don't want it to affect its type.
import std.algorithm, core.stdc.stdlib;
struct X(int defaultSize = 100)
{
int Size;
On 08/11/2016 11:11 AM, Engine Machine wrote:
> I have the need, in some cases, to pass static information to a template
> class but don't want it to affect its type.
>
> import std.algorithm, core.stdc.stdlib;
> struct X(int defaultSize = 100)
> {
>int Size;
>int* p;
>void foo(int siz
On Thursday, 11 August 2016 at 17:56:59 UTC, Charles Hixson wrote:
Does anyone know the correct approach?
I do:
°°
immutable class Foo
{
this() {}
}
void main()
{
auto foo = new immutable(Foo);
}
°°
But take care because you can
On 8/11/16 2:11 PM, Engine Machine wrote:
I have the need, in some cases, to pass static information to a template
class but don't want it to affect its type.
import std.algorithm, core.stdc.stdlib;
struct X(int defaultSize = 100)
{
int Size;
int* p;
void foo(int size)
{
Size = m
On Thursday, 11 August 2016 at 18:11:30 UTC, Engine Machine wrote:
Is there any way to get D to understand I want do not want a
template parameter to be part of the type comparison?
No. Use a standard run-time parameter. Your problem can be solved
by defining a constructor.
On Thursday, 11 August 2016 at 18:11:30 UTC, Engine Machine wrote:
I have the need, in some cases, to pass static information to a
template class but don't want it to affect its type.
import std.algorithm, core.stdc.stdlib;
struct X(int defaultSize = 100)
{
int Size;
int* p;
void foo(i
I have the need, in some cases, to pass static information to a
template class but don't want it to affect its type.
import std.algorithm, core.stdc.stdlib;
struct X(int defaultSize = 100)
{
int Size;
int* p;
void foo(int size)
{
Size = max(size, defaultSize);
p = cast(int*)m
template F1(T)
{
void bar() { writeln("Bar0"); }
}
template F2(T)
{
mixin F1!T;
void foo() { bar(); }
}
template F3(T)
{
mixin F2!T;
void bar() { writeln("Bar1"); } // <- This bar should be used
for F2's foo!
}
struct F4(T)
{
mixin F3!T;
}
(Or on can turn F3 in to a struc
I want to declare a class all instances of which will be immutable, and
all references to which will be inherently immutable (so that I don't
need to slip a huge number of "immutable" statements in my code).
This is surely possible, because string acts just that way, but I can't
figure out how
On Thursday, August 11, 2016 08:42:27 Steven Schveighoffer via Digitalmars-d-
learn wrote:
> On 8/11/16 12:28 AM, Jonathan M Davis via Digitalmars-d-learn wrote:
> > On Wednesday, August 10, 2016 21:00:01 Lodovico Giaretta via
> > Digitalmars-d-
> >
> > learn wrote:
> >> Wow. Thanks. I didn't know
On Thursday, 11 August 2016 at 05:12:39 UTC, ag0aep6g wrote:
On 08/11/2016 06:15 AM, Engine Machine wrote:
void foo(@nogc void delegate())
doesn't work.
Put it after the parameter list, like so:
void foo(void delegate() @nogc)
You may also need to add the scope keyword too.
Reference:
htt
On 8/10/16 5:14 PM, ag0aep6g wrote:
On 08/10/2016 10:54 PM, Steven Schveighoffer wrote:
The issue is that it tries using [] on the item to see if it defines a
range-like thing. Since you don't define opSlice(), it automatically
goes to the subrange.
This breaks for int[] as well as Array.
If I
On 8/11/16 12:28 AM, Jonathan M Davis via Digitalmars-d-learn wrote:
On Wednesday, August 10, 2016 21:00:01 Lodovico Giaretta via Digitalmars-d-
learn wrote:
Wow. Thanks. I didn't know the compiler would try opSlice. I will
file it.
It does that so that you can use foreach with containers with
On Wednesday, 10 August 2016 at 23:32:54 UTC, WhatMeWorry wrote:
Afterall, isn't that the definition of a string? So what's up
with the two groupings of single quotes?
http://www.howtogeek.com/howto/29980/whats-the-difference-between-single-and-double-quotes-in-the-bash-shell/
47 matches
Mail list logo