On 5/6/14, bearophile via Digitalmars-d-learn
wrote:
> There is now std.traits.isInstanceOf that could do what you need.
Someone resurrected a thread from 2011. Of course there's isInstanceOf
when I added it myself at the end of 2012.
Mark Isaacson:
I'm trying my hand at reading from standard input and having
little luck. In particular, I would like to be able to do the
rough equivalent of C++'s:
cin >> myString;
There isn't always a 1:1 mapping between C++ and D. In D if you
want a single word you usually read the whol
Fair enough. I've done stuff like that in the past. I'm trying to
implement a university project that was originally designed for
C++ style I/O... and so where I'd have otherwise jumped at
something like that from the beginning, my hands are slightly
tied.
Suppose I'll make due/not fully comp
Mark Isaacson:
Fair enough. I've done stuff like that in the past. I'm trying
to implement a university project that was originally designed
for C++ style I/O... and so where I'd have otherwise jumped at
something like that from the beginning, my hands are slightly
tied.
If you need/want to
Indeed. However, doing so looks more painful than redefining my
goals. Upon further examination it seems that I had more
flexibility than I originally estimated. Besides, the real reason
I'm implementing this project is just to practice for when I get
to write production D code in a week anyway
Mark Isaacson:
Indeed. However, doing so looks more painful than redefining my
goals. Upon further examination it seems that I had more
flexibility than I originally estimated. Besides, the real
reason I'm implementing this project is just to practice for
when I get to write production D code
On Mon, 05 May 2014 22:16:58 -0400
Nick Sabalausky via Digitalmars-d-learn
wrote:
> On 5/5/2014 10:11 PM, Nick Sabalausky wrote:
> > Is this kinds stuff a sane thing to do, or does it just work by
> > accident?:
> >
> > void modify(ubyte[] dynamicArr)
> > {
> > dynamicArr[$-1] = 5;
> > }
> >
Hi,everyone,
I find the The writeln() function's args can't be ["一" ,"二"]?
why?
Thank you.
Frank.
On Tuesday, 6 May 2014 at 09:43:10 UTC, FrankLike wrote:
Hi,everyone,
I find the The writeln() function's args can't be ["一" ,"二"]?
why?
Thank you.
Frank.
The problem is that you have a wide-character comma (,) there.
This works:
void main() {
writeln(["一", "二"]);
}
I have got same error. I need to pass in instance of class
constant, but got error "Error: static variable cannot be read
at compile"
http://www.everfall.com/paste/id.php?1mc9mb9cxyie
When I had create instance of class in main, and create
confvarible above it all worked, but when I had move
On Monday, 5 May 2014 at 17:55:37 UTC, Meta wrote:
enum offsetof(T, string field) = mixin(type.stringof ~ "." ~
field ~ ".offsetof");
To ensure that a syntactically valid symbol is passed as the
type.
Interestingly, but this code doesn't compile:
enum offsetof(typenfield) = mixin(type.st
Is it a good idea to add a function like this to Phobos?
This is just a first draft of the idea.
void main() {
import std.stdio, std.algorithm, std.range, range_matcher;
auto primes = iota(2, uint.max)
.filter!(x => iota(2, x)
.all!(t =
Hello.
I'm developing library and want to add an examples to the same
project. If I understand corecly, DUB allows to build a
dependencies from another folder and use them to build a program.
I've tried two ways - subConfigurations and subPackages. For
example, there is subConfigurations confi
On Tuesday, 6 May 2014 at 11:09:37 UTC, Andrey wrote:
On Monday, 5 May 2014 at 17:55:37 UTC, Meta wrote:
enum offsetof(T, string field) = mixin(type.stringof ~ "." ~
field ~ ".offsetof");
To ensure that a syntactically valid symbol is passed as the
type.
Interestingly, but this code does
On Tuesday, 6 May 2014 at 03:26:52 UTC, Ali Çehreli wrote:
On 05/05/2014 04:32 PM, Caslav Sabani wrote:
> So basically using threads in D for creating multiple
instances of class is
> actually slower.
Not at all! That statement can be true only in certain
programs. :)
Ali
But what does ex
The problem is that you have a wide-character comma (,) there.
This works:
void main() {
writeln(["一", "二"]);
}
No,I mean the execute result is error.That doesn't get the ["一",
"二"],but get the ["涓C","浜?].
Why?
Thank you.
Frank.
On 05/06/2014 03:16 AM, Suliman wrote:
> When I had create instance of class in main, and create confvarible
> above it all worked, but when I had moved it's in module I got error.
There is module 'static this()' for such runtime initialization:
Config config;
static this()
{
config = new
I'm not sure why you'd want to wrap the .offsetof expression in
a template, but it can easily be done like this:
enum offsetOf(alias A, string S) = mixin("A."~S~".offsetof");
Keep in mind that D's offsetof is flawed - if the object does not
contain the requested member, but implicitly convert
Artur Skawina:
Keep in mind that D's offsetof is flawed - if the object does
not contain the requested member, but implicitly converts to
another one that does have such field then the expression
compiles, but yields a bogus value. Eg
struct S { int a, b, c; S2 s2; alias s2 this; }
stru
Thanks! But is there any other solution? I am thinking that I am
trying to specify config name by wrong way...
On Tuesday, 6 May 2014 at 13:35:57 UTC, FrankLike wrote:
The problem is that you have a wide-character comma (,) there.
This works:
void main() {
writeln(["一", "二"]);
}
No,I mean the execute result is error.That doesn't get the
["一", "二"],but get the ["涓C","浜?].
Why?
Thank yo
On Tuesday, 6 May 2014 at 14:25:01 UTC, Artur Skawina via
Digitalmars-d-learn wrote:
I'm not sure why you'd want to wrap the .offsetof expression in
a template, but it can easily be done like this:
enum offsetOf(alias A, string S) = mixin("A."~S~".offsetof");
Great, that's even shorter.
So
On Tue, 06 May 2014 15:48:44 +0100, Marc Schütz wrote:
On Tuesday, 6 May 2014 at 13:35:57 UTC, FrankLike wrote:
The problem is that you have a wide-character comma (,) there.
This works:
void main() {
writeln(["一", "二"]);
}
No,I mean the execute result is error.That doesn't ge
On 05/06/14 16:45, via Digitalmars-d-learn wrote:
> On Tuesday, 6 May 2014 at 14:25:01 UTC, Artur Skawina via Digitalmars-d-learn
> wrote:
>> I'm not sure why you'd want to wrap the .offsetof expression in
>> a template, but it can easily be done like this:
>>
>>enum offsetOf(alias A, string S
Artur Skawina:
And, I have no idea if the, hmm, /unconventional/ D offsetof
semantics
are in the bugzilla. It's not really a "bug", but a design
mistake...
Design mistakes are valid bugzilla entries. At worst the bad
behavior could be documented. But often it's possible to fix the
design to
On Tue, May 06, 2014 at 01:06:14AM -0700, Jonathan M Davis via
Digitalmars-d-learn wrote:
> On Mon, 05 May 2014 22:16:58 -0400
> Nick Sabalausky via Digitalmars-d-learn
> wrote:
>
> > On 5/5/2014 10:11 PM, Nick Sabalausky wrote:
> > > Is this kinds stuff a sane thing to do, or does it just work
H. S. Teoh:
Exercise for the reader: spot the bug.
https://issues.dlang.org/show_bug.cgi?id=5212
https://issues.dlang.org/show_bug.cgi?id=11657
Bye,
bearophile
On Monday, 5 May 2014 at 22:11:39 UTC, Ali Çehreli wrote:
On 05/05/2014 02:38 PM, Kapps wrote:
> I think that the GC actually blocks when
> creating objects, and thus multiple threads creating
instances would not
> provide a significant speedup, possibly even a slowdown.
Wow! That is the case.
On 05/06/2014 07:40 AM, Suliman wrote:
Thanks! But is there any other solution? I am thinking that I am trying
to specify config name by wrong way...
Sorry, I don't understand what exactly you are trying to do. :( Is
config file a compile-time concept? Do you want to read it at compile time?
On Tuesday, 6 May 2014 at 15:56:11 UTC, Kapps wrote:
On Monday, 5 May 2014 at 22:11:39 UTC, Ali Çehreli wrote:
On 05/05/2014 02:38 PM, Kapps wrote:
> I think that the GC actually blocks when
> creating objects, and thus multiple threads creating
instances would not
> provide a significant speed
I am tying to hardcode name of config file name. Then I would
read and parse it.
An exceptionally generous offer! May take you up on that. Thank
you :).
On 05/06/2014 05:46 AM, hardcoremore wrote:
> But what does exactly means that Garbage Collector blocks? What
> does it blocks and in which way?
I know this much: The current GC that comes in D runtime is a
single-threaded GC (aka "a stop-the-world GC"), meaning that all threads
are stopped wh
I am trying to write simple parser, that split text to
key value
name = david
lastname = wood
here is my code:
foreach (line; readText(confname).splitLines())
{
writeln(line);
foreach (str; split(line, "="))
I'm working on small compiler to understand these stuff and maybe
get involved with the D compiler. I wrote a front-end to a C-like
language and now I'm working on the code generator. To be more
specific, in the register allocation phase. I was using a old and
one where I put everything on stac
On Tuesday, 6 May 2014 at 02:17:06 UTC, Nick Sabalausky wrote:
So all is well, and deliberately so. Pardon the noise.
IMO it's not. I once had a particularly nasty bug because of this:
struct S
{
@safe:
string str;
this(string data)
{
im
FYI:
If anyone is using GitHub's text editor "Atom" and would like
basic D syntax highlighting:
apm init --package ~/.atom/packages/language-d --convert
https://github.com/textmate/d.tmbundle
https://atom.io/docs/v0.94.0/converting-a-text-mate-bundle
On Tuesday, 6 May 2014 at 15:03:11 UTC, Regan Heath wrote:
On Tue, 06 May 2014 15:48:44 +0100, Marc Schütz
wrote:
On Tuesday, 6 May 2014 at 13:35:57 UTC, FrankLike wrote:
The problem is that you have a wide-character comma (,)
there.
This works:
void main() {
writeln(["一", "二"]);
On 05/06/2014 04:56 PM, FrankLike wrote:
> On Tuesday, 6 May 2014 at 15:03:11 UTC, Regan Heath wrote:
>> IIRC you need to type "chcp 65001" and set the command prompt to the
>> Lucida font...
>>
>> R
>
> No,it's error.My OS is windows 7,chcp 936. SimpleChinese.
> I use the 'go language' to test
That is understandable: Since the console is set to 936, it
interprets D program's UTF-8 output incorrectly.
Please do what Regan Heath says and test again:
1) Set the code page to 65001
2) Use a font that includes your Unicode characters
Ali
Thank you.
I modify it by the 'Regedit'(my O
40 matches
Mail list logo