general.
>
> What I mean is that you can annotate your code with version statements like:
>
> version(LittleEndian)
> {
> // perform the byteswap
> ...
> }
>
> so your code is portable to BigEndian systems (where you would not want
> to byte swap).
That's a good point, thanks.
--
Marek Janukowicz
compile the correct code.
This solution is of no use to me as I don't want to change the endianess in
general.
--
Marek Janukowicz
writefln( "proper: %s, reverse: %s",
cast(wchar[])properOrder,
cast(wchar[])reverseOrder );
}
output:
proper: 䈁, reverse: ł
Is there anything I should know about UTF endianess?
--
Marek Janukowicz
\nworld"
>
> Or if you want to include the \n verbatim:
>
> "Hello\r
> world"
Thanks, this works - I don't know how I did it the first time, because I
definitely tried that and failed.
The other solution by Adam also works - thanks.
--
Marek Janukowicz
Is there any way to input such a literal? Both `...` and q"EOS...EOS" do not
allow escape sequences. I'm on Linux, but I need precisely CRLF, not just
\n.
--
Marek Janukowicz
b") it compiles
fine.
Is this another bug or am I missing something?
--
Marek Janukowicz
How do I mark a function as returning shared object?
This won't compile:
shared Foo foo () {
...
}
This does, but looks somewhat awkward to me:
shared (shared Foo) foo () {
...
}
--
Marek Janukowicz
ceive than some
type of multiple "cast & check" clauses.
On a related matter - how does GC behave on such class objects (created in
one thread, casted to shared and handled by another thread)? Won't the
object get possibly GC'ed when it runs out of scope in origin thread
or
> linked me to it I played briefly and thought it was pretty boss.
Wow, that was quick :)
D-tui looks like something worth taking a look - thanks.
--
Marek Janukowicz
Is there any console widget library available for D? I mean something like
high level library on top of ncurses. Maybe anyone took a shot at libyui
wrapper?
--
Marek Janukowicz
Ali Çehreli wrote:
> On 09/16/2013 01:24 PM, Marek Janukowicz wrote:
>
> >static string[string] columns () {
> // ...
> >}
>
> Although the function itself is static, it returns a dynamic value.
>
> > foreach( attr, col; columns() ) {
>
refore, even from main.d, the two mixed-in functions 'a' have
> same closeness, and the call is ambiguous because they have
> exactly same signature.
--
Marek Janukowicz
foreach( attr, col; columns() ) {
__traits(getMember, me, attr) = typeof(__traits(getMember, me,
attr)).init;
}
return me;
}
}
class ExampleModel {
@Attr() int id;
@Attr( "field_id" ) int fieldId;
mixin Model;
}
void main () {
ExampleModel ex = ExampleModel.ini
any other
way for columns() method to return a structure that could be further
evaluated at compile time?
--
Marek Janukowicz
oesn't when it's a mixed-in function with no mixin identifier.
My first impression is that either both line 1 and 2 should work or neither
of them should work. It's no surprise to me that line 3 works (and it
matches the documentation), so I basically included that just for reference.
--
Marek Janukowicz
H. S. Teoh wrote:
> On Thu, Aug 29, 2013 at 12:45:05AM +0200, Marek Janukowicz wrote:
>> H. S. Teoh wrote:
> [...]
>> > Oh, and BTW, are you on Linux 32-bit or 64-bit? Don't know if that
>> > makes a difference, but just in case.
>>
>> 64-bit
> [
H. S. Teoh wrote:
> On Wed, Aug 28, 2013 at 11:02:17PM +0200, Marek Janukowicz wrote:
>> I was finally able to create simple test case that probably reproduces
>> the bug (probably, because the stack trace is completely different,
>> but the code that is there is similar). T
ced exactly the same way on 3 machines I tried.
--
Marek Janukowicz
- how can I include a static library with my project? I can compile
algorithm.d to a static lib, but how do I include this one explicitly with
my project while the rest of Phobos should be taken from the stock
libphobos2.a ?
- any other ideas how to solve my problems on any level?
--
Marek Janukowicz
Marek Janukowicz wrote:
> Yet another problem I just spotted:
>
> ---
>
> import std.stdio, std.string;
>
> struct Val {
> int i;
> byte b;
> }
>
> template templ( T ) {
>
>auto templ (T obj, string name) {
&g
After I sent the message I realized my limited English knowledge made me
make a subject that actually had quite a different meaning than I intended
:)
Now it's hopefully fine or at least less ambiguous.
--
Marek Janukowicz
"Version A" (which
means I return the result directly instead of returning the delegate I get
expected results:
$ dmd -run member.d i
i: 1
$ dmd -run member.d b
b: 2
Also no ld warning in this case.
--
Marek Janukowicz
name) ...
}
Of course this looks suboptimal as I run the loop until I find a member
matching the name. Is there any better way to do this?
--
Marek Janukowicz
Dicebot wrote:
> On Tuesday, 20 August 2013 at 15:47:42 UTC, Marek Janukowicz
> wrote:
>> Does anyone know about any decent ORM (Object Relational
>> Mapping or whatever
>> it stands for) libraries for D? If someone actually tried some
>> of those it
>
um Smth { A };
void list () {
foreach( s; __traits(derivedMembers, typeof(this))) {
static if (is (typeof(typeof(typeof(__traits(getMember, this, s ==
int)) {
writefln ("%s is int", s );
}
}
}
}
void main () {
A a = new A();
a.list();
}
--
Marek Janukowicz
H. S. Teoh wrote:
> On Wed, Aug 21, 2013 at 01:42:11AM +0200, Marek Janukowicz wrote:
>> Given this short program:
>>
>> class A {
>>
>> int i;
>> //enum Smth { X };
>>
>> void list () {
>> foreach( s; __traits(derivedMember
ts(getMember, this, s))" might be used eg. in static if even
for enums.
Is this a bug or do I miss something (again)?
--
Marek Janukowicz
Ali Çehreli wrote:
> On 08/20/2013 03:47 PM, Marek Janukowicz wrote:> In this program:
> >
> > import std.stdio, std.json;
> >
> > void main () {
> >JSONValue jsonSet;
> >jsonSet.type = JSON_TYPE.OBJECT;
> >JSONValue a = { type
ires two lines instead of one
and I have many such elements to set. I can't initialize all members of
JSONValue, because there are many and I only need those two.
--
Marek Janukowicz
Does anyone know about any decent ORM (Object Relational Mapping or whatever
it stands for) libraries for D? If someone actually tried some of those it
would be a big plus.
--
Marek Janukowicz
Dicebot wrote:
> On Tuesday, 20 August 2013 at 11:22:35 UTC, Marek Janukowicz
> wrote:
>>> if(is(type == Setting!U, U...))
>>
>> This is not enough for me - I have many instantiations of
>> Setting struct
>> template and I need all of them, regardless of
ing Setting.
>
> if(is(type == Setting!U, U...))
This is not enough for me - I have many instantiations of Setting struct
template and I need all of them, regardless of parameters they were
instantiated with.
--
Marek Janukowicz
H. S. Teoh wrote:
> On Tue, Aug 20, 2013 at 01:09:16AM +0200, Marek Janukowicz wrote:
>> Jacob Carlborg wrote:
> [...]
>> > In "settings" you should be able to:
>> >
>> > 1. Iterate over all fields of the type Setting using
>> > __tratis
Jacob Carlborg wrote:
> On 2013-08-15 00:29, Marek Janukowicz wrote:
>> I need to have a generalized "settings" functionality that should work
>> like this:
>> * I need to be able to add this to a class
>> * each setting has its name, description, type and
escription above is a bit messy (it's quite late now), but
hopefully you can get the picture. Any ideas how to approach this problem?
--
Marek Janukowicz
k the list first, hoping
there might be some simple solution I don't know about.
--
Marek Janukowicz
us name clash on the variable name "logger". I have many modules where
I want to use logging, so things like static import are not an option.
Is there any pattern I could use here?
--
Marek Janukowicz
them.
See traits: http://dlang.org/traits.html
Look for: getProtection, getVirtualFunctions, getVirtualMethods.
--
Marek Janukowicz
dennis luehring wrote:
> the question is do the published counter then needs locking - and make
> it slow for all - just for beeing getable?
Good point - but I believe the code operating on the counter is synchronized
already, so synchronized getter would not really slow things down.
--
vate... or should I file a bug (or rather feature request) about
it?
--
Marek Janukowicz
Ali Çehreli wrote:
> On 08/05/2013 04:18 PM, Marek Janukowicz wrote:
>> I'm using std.concurrency message passing and I'd like to check which
>> thread might be a bottleneck. The easiest would be check number of
>> messages piled up for each of them, but I could n
I'm using std.concurrency message passing and I'd like to check which thread
might be a bottleneck. The easiest would be check number of messages piled
up for each of them, but I could not find a way to do that. Is it possible?
Every detail about MessageBox seems to be hidden...
is not being
restarted, but you need to handle that yourself.
--
Marek Janukowicz
Robik wrote:
> I think std.conv.to!string is what are you looking for :)
>
> http://dpaste.dzfl.pl/e1c38f8f
Wow, so simple, thanks
--
Marek Janukowicz
et string a "UNKNOWN". Of course
I'd like to use something more consise and elegant than a switch :)
--
Marek Janukowicz
ill run to completion before the program
> terminates normally (see Thread.isDaemon).
It's really nice to have some chat about the correctness of example code
snippets, but can anyone help me with the original issue? :)
--
Marek Janukowicz
dennis luehring wrote:
> Am 03.08.2013 08:38, schrieb Marek Janukowicz:
>> void main ()
>> {
>>writefln( "sa: %d", SA_RESTART );
>>(new Thread (&serverfunc)).start();
>>(new Thread (&clientfunc)).start();
>> }
>
> i h
ew Thread (&serverfunc)).start();
(new Thread (&clientfunc)).start();
}
If I disable GC the problem does not occur.
Any idea how to solve this?
--
Marek Janukowicz
main copy. Is it possible to somehow create copy
automatically when creating a task, or do I need to create it myself? If the
latter - is there anything in std lib that helps with creation of deep
clones or an I completely on my own?
--
Marek Janukowicz
implement
with a regular template.
--
Marek Janukowicz
Hello
I have a repetitive piece of code that I'm now generating using
string mixin. I humbly ask someone more skilled with D to review
the code and help me transforming it into regular template mixin
(as I would gladly avoid string mixin if possible).
string flaggedAttr(string type, string n
51 matches
Mail list logo