On 2014-01-24 07:11, Uplink_Coder wrote:
I'm trying to serialize my struct through CT-Refelction
Here's a serialization library if you need it [1]. It will hopefully be
included as std.serialization in Phobos at some point.
https://github.com/jacob-carlborg/orange
--
/Jacob Carlborg
I'm trying to serialize my struct through CT-Refelction
Am 23.01.2014 15:44, schrieb Frustrated:
So, TLS solves the data issue with threading. I just thought,
with out much thinking, what about having thread local functions?
Doesn't make sense? Let me explain.
Functions generally are not thread safe because of reentry,
right? The same data is used by
On Thursday, 23 January 2014 at 10:25:40 UTC, Timon Gehr wrote:
Sure. Their existence means it is in general wrong to think of
a dchar as one character.
As stated, I was specifically talking about the Unicode
definition of a character, which is completely distinct from
graphemes.
On Monday, 20 January 2014 at 02:30:46 UTC, CJS wrote:
For future reference, I tried but wasn't able to make calling D
from python work. I tried to just compile D to an .a library,
including statically linking phobos, and then wrapping it with
cython like I would with C code. (I've made this
On Tuesday, 21 January 2014 at 14:19:51 UTC, Russel Winder wrote:
I appear to be unable to use Google the last couple of days :-(
so I
admit defeat, expose my current ignorance, hopefully to quickly
become
enlightened.
Is it possible to easily with DMD, LDC and/or GDC create shared
objects
a
On 01/23/2014 07:26 AM, Chris wrote:
> On Thursday, 23 January 2014 at 15:24:19 UTC, Chris wrote:
>> Here's what I'm trying to do.
>>
>> struct Element(T) {
>> T x;
>> T y;
>>
>> public void setX(T value) {
>> x = value;
>> }
>> // More fancy functions ...
>> }
>>
>> I s
Anyway, why do you need pointers to elements?
On Thursday, 23 January 2014 at 15:24:19 UTC, Chris wrote:
Thanks, that was fast! Yes I was tinkering around with
pointers, but didn't get it right, you did. However, the output
is still the same, i.e. two different sets:
// After creating and changing
Hello, world!
// The Elements in Tr
On Thursday, 23 January 2014 at 23:42:26 UTC, Uplink_Coder wrote:
When I try to
struct _pod_ {
string s1;
enum e1 { v1,v2 };
}
auto printPod(Pod)() if (__traits(isPOD,Pod)) {
string result;
foreach (member;__traits(allMembers,Pod) ) {
auto _member=__traits(ge
When I try to
struct _pod_ {
string s1;
enum e1 { v1,v2 };
}
auto printPod(Pod)() if (__traits(isPOD,Pod)) {
string result;
foreach (member;__traits(allMembers,Pod) ) {
auto _member=__traits(getMember,Pod,member);
}
writeln(result);
}
void main
On Thursday, 23 January 2014 at 19:40:42 UTC, Kagamin wrote:
On Tuesday, 21 January 2014 at 17:53:38 UTC, Russel Winder It's
linux users, who use linux. Windows users don't use windows for
anything, they use software running on windows, lol.
It awesome how this statement can be read as both li
On Tuesday, 21 January 2014 at 17:53:38 UTC, Russel Winder wrote:
I'll have to get my wife's Windows 7 machine out to test all
the D tool
changes I am making. It is a real shame that anyone actually
uses
Windows for anything :-)
It's linux users, who use linux. Windows users don't use windows
A minor caveat is GDC treats shared as volatile, which can be not
optimal. Even worse, on some platforms like itanium volatile
generates fences.
Great now it works!
Thanks for your time :D
On Thursday, 23 January 2014 at 17:59:05 UTC, Uplink_Coder wrote:
First and foremost, I'd suggest you use the beautiful solution
proposed by Meta.
But to illustrate problems with your code:
foreach (i,Item;[__traits(allMembers,Enum)]) {
This is the culprit. More specifically, you don't n
Oh my bad
wasn't too carefull with deletion
auto EnumToSelect(Enum)(string Name = __traits(identifier,Enum))
if (is(Enum==enum)) {
foreach (i,Item;[__traits(allMembers,Enum)]) {
reslt ~= "\toption(value='"~__traits(getMember,Enum,Item)~"')
"~Item~"\n";
}
debug import std.stdio;
debug
Could you show an exact code that fails?
sure!
auto EnumToSelect(Enum)(string Name = __traits(identifier,Enum))
if (is(Enum==enum)) {
foreach (i,Item;[__traits(allMembers,Enum)]) {
else
form_string ~= "\toption(value='"~Item~"')
"~__traits(getMember,Enum,It
On Thursday, 23 January 2014 at 16:00:30 UTC, Francesco Cattoglio
wrote:
Sorry, MY BAD!
You can just write
auto handler = new Handler;
receive(&handler.MyFunc);
Somehow when I tried this before it failed to compile, and I
thought I had to go through loops for achieving this.
It's also useful
On Thursday, 23 January 2014 at 15:07:18 UTC, Uplink_Coder wrote:
Hello,
I have an Enum to represent possible Options for a selectList
e.g
enum options {
blueish="Blue",
redish ="Red"
}
and I want the List-Entrys to say
"blueish" or "redish".
the value send to the app should be
"Blue" or "Re
void main() {
foreach(m; EnumMembers!Options) {
writeln(m, " ", cast(string)m);
}
}
Still not there at compile-time
... because I need to index my members
On Thursday, 23 January 2014 at 17:15:41 UTC, Uplink_Coder wrote:
void main() {
foreach(m; EnumMembers!Options) {
writeln(m, " ", cast(string)m);
}
}
Still not there at compile-time
... because I need to index my members
Could you show an exact code that fails?
On Thursday, 23 January 2014 at 16:40:49 UTC, Frustrated wrote:
Yes, I that is what I tried initially but the error was due to
that static if.
Not sure why
but
static if (is(T : A))
{
...
}
static assert(0,
On Thursday, 23 January 2014 at 16:15:46 UTC, Frustrated wrote:
The point is that making the **STACK** TLS too should a way
around having to use synchronization.
Precisely because the STACK is not TLS makes functions not
thread
safe(since data is already "safe" in d).
Maybe you could elabora
Yes, I that is what I tried initially but the error was due to
that static if.
Not sure why
but
static if (is(T : A))
{
...
}
static assert(0, "error");
doesn't work as the assert is called no matter what.
On Thursday, 23 January 2014 at 16:15:46 UTC, Frustrated wrote:
On Thursday, 23 January 2014 at 14:49:11 UTC, Dicebot wrote:
On Thursday, 23 January 2014 at 14:44:01 UTC, Frustrated wrote:
Precisely because the STACK is not TLS makes functions not
thread
safe(since data is already "safe" in
On Thursday, 23 January 2014 at 15:31:53 UTC, Uplink_Coder wrote:
Try getMember: http://dlang.org/traits.html#getMember
if i try it, I get __aggr2297 cannot be read at compile time
There's a convenience wrapper for that, EnumMembers:
http://dlang.org/phobos/std_traits.html#.EnumMembers
void
On Thursday, 23 January 2014 at 16:21:39 UTC, Frustrated wrote:
static if (T is A)
Try:
static if(is(T : A)) {}
The is() thingy is different than the is operator. T:A means "T
implicitly converts to A", so if T is a class implementing
interface A, that would pass.
There's
I am trying to compare a type with another type at compile time.
My code is
class Q(T)
{
static auto foo()
{
static if (T is A)
{
...
}
static assert(0, "error");
}
}
and get the error "
On Thursday, 23 January 2014 at 14:49:11 UTC, Dicebot wrote:
On Thursday, 23 January 2014 at 14:44:01 UTC, Frustrated wrote:
Functions generally are not thread safe because of reentry,
right?
No. They are not thread safe because they use shared data
(explicitly/implicitly). Functions that onl
Sorry, MY BAD!
You can just write
auto handler = new Handler;
receive(&handler.MyFunc);
Somehow when I tried this before it failed to compile, and I
thought I had to go through loops for achieving this.
On Thursday, 23 January 2014 at 15:34:38 UTC, FreeSlave wrote:
On Thursday, 23 January 2014 at 15:24:19 UTC, Chris wrote:
Here's what I'm trying to do.
struct Element(T) {
T x;
T y;
public void setX(T value) {
x = value;
}
// More fancy functions ...
}
I store Element(s) i
Suppose that I receive a message, but instead of defining a
function inside the receive() block, I want to call a member of a
class instance. (This is useful to me for several reasons). Right
now my code looks like:
class Handler {
auto handle() {
return (string msg) {
writeln("rec
On Thursday, 23 January 2014 at 15:24:19 UTC, Chris wrote:
Here's what I'm trying to do.
struct Element(T) {
T x;
T y;
public void setX(T value) {
x = value;
}
// More fancy functions ...
}
I store Element(s) in an array and want to pass each one by
reference, which
Try getMember: http://dlang.org/traits.html#getMember
if i try it, I get __aggr2297 cannot be read at compile time
On Thursday, 23 January 2014 at 15:24:19 UTC, Chris wrote:
Here's what I'm trying to do.
struct Element(T) {
T x;
T y;
public void setX(T value) {
x = value;
}
// More fancy functions ...
}
I store Element(s) in an array and want to pass each one by
reference, which
Here's what I'm trying to do.
struct Element(T) {
T x;
T y;
public void setX(T value) {
x = value;
}
// More fancy functions ...
}
I store Element(s) in an array and want to pass each one by
reference, which does not work.
class Tree {
Element!string[] element
On 2014-01-23 16:07, Uplink_Coder wrote:
Hello,
I have an Enum to represent possible Options for a selectList
e.g
enum options {
blueish="Blue",
redish ="Red"
}
and I want the List-Entrys to say
"blueish" or "redish".
the value send to the app should be
"Blue" or "Red".
I can use __traits(
On Thursday, 23 January 2014 at 15:00:17 UTC, sg wrote:
On Thursday, 23 January 2014 at 14:25:41 UTC, Rikki Cattermole
wrote:
On Thursday, 23 January 2014 at 13:57:43 UTC, sg wrote:
Ddoc itself is provided as part of the D compiler. For usage
with D source code.
Following is from http://d
On Thursday, 23 January 2014 at 15:07:18 UTC, Uplink_Coder wrote:
Hello,
I have an Enum to represent possible Options for a selectList
e.g
enum options {
blueish="Blue",
redish ="Red"
}
and I want the List-Entrys to say
"blueish" or "redish".
the value send to the app should be
"Blue" or "Re
Hello,
I have an Enum to represent possible Options for a selectList
e.g
enum options {
blueish="Blue",
redish ="Red"
}
and I want the List-Entrys to say
"blueish" or "redish".
the value send to the app should be
"Blue" or "Red".
I can use __traits(allMembers,Enum)
for the identifiers, but ho
On Thursday, 23 January 2014 at 14:25:41 UTC, Rikki Cattermole
wrote:
On Thursday, 23 January 2014 at 13:57:43 UTC, sg wrote:
Ddoc itself is provided as part of the D compiler. For usage
with D source code.
Following is from http://dlang.org/ddoc.html
Using Ddoc for other Documentation
D
On Thursday, 23 January 2014 at 14:44:01 UTC, Frustrated wrote:
Functions generally are not thread safe because of reentry,
right?
No. They are not thread safe because they use shared data
(explicitly/implicitly). Functions that only use thread-local
data are always thread-safe.
So, TLS solves the data issue with threading. I just thought,
with out much thinking, what about having thread local functions?
Doesn't make sense? Let me explain.
Functions generally are not thread safe because of reentry,
right? The same data is used by the function for each thread
calling it a
On Thursday, 23 January 2014 at 13:57:43 UTC, sg wrote:
I have looked at http://dlang.org/ddoc.html and
http://qznc.github.io/d-tut/documentation.html and have some
idea about how to write the text that will eventually become
the document. But I have no clue as to go from the input file
wit
I have looked at http://dlang.org/ddoc.html and
http://qznc.github.io/d-tut/documentation.html and have some idea
about how to write the text that will eventually become the
document. But I have no clue as to go from the input file with
Ddoc comments to the final document. I am on Windows 7
On 01/23/2014 02:39 AM, Jakob Ovrum wrote:
On Thursday, 23 January 2014 at 01:17:19 UTC, Timon Gehr wrote:
On 01/16/2014 06:56 AM, Jakob Ovrum wrote:
Note that the Unicode definition of an unqualified "character" is the
translation of a code *point*, which is very different from a *glyph*,
whi
47 matches
Mail list logo