On Mon, 12 Jan 2015 23:06:16 +
jmh530 via Digitalmars-d-learn
wrote:
> I had seen some stuff on alias thing, but I hadn't bothered to
> try to understand it until now. If I'm understanding the first
> example http://dlang.org/class.html#AliasThis";>here,
> alias this let's you refer to x in s
On Mon, 12 Jan 2015 22:07:13 +
aldanor via Digitalmars-d-learn
wrote:
> I see, thanks! :) I've started liking structs more and more
> recently as well and been pondering on how to convert a
> class-based code that looks like this (only the base class has
> any data):
it's hard to tell by b
On Mon, 12 Jan 2015 22:07:13 +
aldanor via Digitalmars-d-learn
wrote:
> I see, thanks! :) I've started liking structs more and more
> recently as well and been pondering on how to convert a
> class-based code that looks like this (only the base class has
> any data):
p.s. can't you convert
Have the following directory structure?
~/testModule$ find . -print
.
./net
./net/http_.d# **
./net/http
./net/http/Mod1.d
./net/http/Mod2.d
./main.d
** I put the _ here to make it seperate from the net/http
directory. Probably, a better solution exists, this was hacked
together quickly :)
On Tuesday, 13 January 2015 at 09:22:04 UTC, Colin wrote:
Have the following directory structure?
~/testModule$ find . -print
.
./net
./net/http_.d# **
./net/http
./net/http/Mod1.d
./net/http/Mod2.d
./main.d
** I put the _ here to make it seperate from the net/http
directory. Probably, a be
Nordlöw:
Has there been any discussions on
making map require pure functions now that we have each?
Perhaps I'd like Phobos map and filter to be annotated with
"pure" and to have a template constraint that requires their
mapping/filtering functions to be strongly pure.
Bye,
bearophile
On Tuesday, 13 January 2015 at 10:06:26 UTC, bearophile wrote:
Nordlöw:
Has there been any discussions on
making map require pure functions now that we have each?
Perhaps I'd like Phobos map and filter to be annotated with
"pure" and to have a template constraint that requires their
mapping
On Tuesday, 13 January 2015 at 10:21:12 UTC, Tobias Pankrath
wrote:
On Tuesday, 13 January 2015 at 10:06:26 UTC, bearophile wrote:
Nordlöw:
Has there been any discussions on
making map require pure functions now that we have each?
Perhaps I'd like Phobos map and filter to be annotated with
On Tue, 13 Jan 2015 10:06:25 +
bearophile via Digitalmars-d-learn
wrote:
> Nordlöw:
>
> > Has there been any discussions on
> > making map require pure functions now that we have each?
>
> Perhaps I'd like Phobos map and filter to be annotated with
> "pure" and to have a template constrain
Ah, I just re-read your OP. Your already at this point :)
Since everybody has understood the problem, and nobody could have
come up with a solution yet, my idea is that:
HttpSocketConnectionRequest.d
=
module net.http.HttpSocketConnectionRequest;
module c
ketmar:
that will effectively rule out any usage of some global vars or
other
external state, turning it into either unnecessary mess, or
unusable
theoretical crap.
"Unusable theoretical crap" is better than the current trap :-)
We hare "pure" in D, but still we have not grown up to actuall
"Unusable theoretical crap" is better than the current trap :-)
We hare "pure" in D, but still we have not grown up to actually
use it in Phobos, for higher order functions, or parallelism.
I don't think that Nordlöw presented a serious trap. This might
lead to bugs, yes, like anything else,
On Tue, 13 Jan 2015 11:26:01 +
bearophile via Digitalmars-d-learn
wrote:
> ketmar:
>
> > that will effectively rule out any usage of some global vars or
> > other
> > external state, turning it into either unnecessary mess, or
> > unusable
> > theoretical crap.
>
> "Unusable theoretical c
V Tue, 13 Jan 2015 10:58:27 +
tcak via Digitalmars-d-learn
napsáno:
> >
> > Ah, I just re-read your OP. Your already at this point :)
>
> Since everybody has understood the problem, and nobody could have
> come up with a solution yet, my idea is that:
>
> HttpSocketConnectionRequest.d
> ==
ketmar:
in no way. this just turns Phobos into the same unusable crap,
removing the whole sense of having good standard library.
If your language has purity, and it doesn't use it where it
matters, you have removed its sense of having purity. So if you
are right then purity in D is useless a
I get
core.exception.UnicodeException@src/rt/util/utf.d(290):
in a call to
std.string.tr(x, `_`, ` `)
for a badly encode string x. Is it really needed to do
auto-decoding here?
Isn't the encoding of underscore and space uniquely one by byte
in UTF-8?
What do I need to do/add to a
V Tue, 13 Jan 2015 12:32:15 +
"Nordlöw" via Digitalmars-d-learn
napsáno:
> I get
>
> core.exception.UnicodeException@src/rt/util/utf.d(290):
>
> in a call to
>
> std.string.tr(x, `_`, ` `)
>
> for a badly encode string x. Is it really needed to do
> auto-decoding here?
>
> Isn
I want to read all input from stdin without blocking. That means
I simply want to read the remaining input from stdin. All ways I
tried so far always end up in me waiting for the user to enter
additional input, which is not what I want.
I tried around a lot with D's files / streams but couldn'
On 1/13/2015 10:01 AM, Andrew Grace wrote:
I am trying to play with D, but I'm getting stuck with the DUB package
manager. If use DUB to download a package to my project, how do I get
DUB to add what I downloaded to the dub.json file? I have tried DUB
--fetch --cache=local http-parser (for examp
On Friday, 9 January 2015 at 19:03:04 UTC, Steven Schveighoffer
wrote:
On 1/9/15 1:50 PM, John Colvin wrote:
On Friday, 9 January 2015 at 18:35:56 UTC, anonymous wrote:
On Friday, 9 January 2015 at 18:25:42 UTC, John Colvin wrote:
struct S
{
void* p;
}
void main()
{
S s;
auto a = cast(v
I have written the following code:
test.d
==
import core.thread;
import std.stdio;
void threadFunc(){
writeln("Thread func");
}
public static this(){
auto t = new Thread( &threadFunc );
t.start();
writeln("Static init");
}
void main(
On Tuesday, 13 January 2015 at 13:53:11 UTC, tcak wrote:
I have written the following code:
test.d
==
import core.thread;
import std.stdio;
void threadFunc(){
writeln("Thread func");
}
public static this(){
auto t = new Thread( &threadFunc );
V Tue, 13 Jan 2015 13:53:09 +
tcak via Digitalmars-d-learn
napsáno:
> I have written the following code:
>
> test.d
> ==
> import core.thread;
> import std.stdio;
>
> void threadFunc(){
> writeln("Thread func");
> }
>
> public static this(){
> auto t
On Tue, 13 Jan 2015 13:56:05 +
tcak via Digitalmars-d-learn wrote:
> it works normal now. But it doesn't explain above issue. What's
> the relation between a new thread and a module's initialiser?
yes.
signature.asc
Description: PGP signature
V Tue, 13 Jan 2015 13:56:05 +
tcak via Digitalmars-d-learn
napsáno:
> On Tuesday, 13 January 2015 at 13:53:11 UTC, tcak wrote:
> > I have written the following code:
> >
> > test.d
> > ==
> > import core.thread;
> > import std.stdio;
> >
> > void threadFunc(){
> >
On Tuesday, 13 January 2015 at 14:02:45 UTC, Daniel Kozák via
Digitalmars-d-learn wrote:
V Tue, 13 Jan 2015 13:56:05 +
tcak via Digitalmars-d-learn
napsáno:
On Tuesday, 13 January 2015 at 13:53:11 UTC, tcak wrote:
> I have written the following code:
>
> test.d
> ==
The operating system does line buffering, so you'll need to turn
that off. The function is tcssetattr() on Posix and
SetConsoleMode on Windows.
My terminal.d does this in struct ctors and dtors:
https://github.com/adamdruppe/arsd/blob/master/terminal.d
example usage:
http://arsdnet.net/dcode/
On Tuesday, 13 January 2015 at 08:33:57 UTC, ketmar via
Digitalmars-d-learn wrote:
On Mon, 12 Jan 2015 22:07:13 +
aldanor via Digitalmars-d-learn
wrote:
I see, thanks! :) I've started liking structs more and more
recently as well and been pondering on how to convert a
class-based code t
This discussion:
http://forum.dlang.org/thread/bqtcdpsopxmnfbjyr...@forum.dlang.org
-- led me wondering if it would be possible to create some
crippled version of a class proxy that is based on RefCounted and
came up with something like this:
struct Box(T) if (is(T == class)) {
@disable t
On Tue, 13 Jan 2015 16:08:15 +
aldanor via Digitalmars-d-learn
wrote:
> On Tuesday, 13 January 2015 at 08:33:57 UTC, ketmar via
> Digitalmars-d-learn wrote:
> > On Mon, 12 Jan 2015 22:07:13 +
> > aldanor via Digitalmars-d-learn
> >
> > wrote:
> >
> >> I see, thanks! :) I've started lik
On Tue, 13 Jan 2015 16:17:51 +
aldanor via Digitalmars-d-learn
wrote:
> This discussion:
> http://forum.dlang.org/thread/bqtcdpsopxmnfbjyr...@forum.dlang.org
> -- led me wondering if it would be possible to create some
> crippled version of a class proxy that is based on RefCounted and
>
>> I see, thanks! :) I've started liking structs more and more
>> recently as well and been pondering on how to convert a
>> class-based code that looks like this (only the base class
>> has any data):
> it's hard to tell by brief description. but having multiple
> inheritance
> immediately rin
Does the following construct hold water?
version(LittleEndian)
{
/// interpret an array of one type as an array of a different
type.
/// if the array has odd length, the highest elements are
/// not accessible, at worst an empty slice is returned
inout ref T[] arrayOf(T, V: U[])(ino
On Tuesday, 13 January 2015 at 17:09:32 UTC, Dominikus Dittes
Scherkl wrote:
I assume taking a slice of a pointer uses the GC, so this
cannot be @nogc, am I right?
Nope, slicing never allocates, it just takes an address and
length.
If you append to a slice or increase the length though, the
On Wednesday, 7 January 2015 at 14:59:58 UTC, H. S. Teoh via
Digitalmars-d-learn wrote:
On Wed, Jan 07, 2015 at 02:52:51PM +, Laeeth Isharc via
Digitalmars-d-learn wrote:
Another schoolboy question.
Suppose I am constructing a tree (in this case it is an AST).
In C I
would have a pointer
On Tuesday, 13 January 2015 at 17:12:42 UTC, Adam D. Ruppe wrote:
On Tuesday, 13 January 2015 at 17:09:32 UTC, Dominikus Dittes
Scherkl wrote:
I assume taking a slice of a pointer uses the GC, so this
cannot be @nogc, am I right?
Nope, slicing never allocates, it just takes an address and
len
On Tuesday, 13 January 2015 at 17:19:42 UTC, Laeeth Isharc wrote:
The GC is allowed to move structs around, as I undestand it.
Under what circumstances do I get into trouble having a pointer
to them?
None, a GC that moves structs around must update every pointer
afterwards and as far as I
On Tue, 13 Jan 2015 17:08:37 +
Laeeth Isharc via Digitalmars-d-learn
wrote:
> I just finished reading aldanor's blog, so I know he is slightly
> allergic to naked functions and prefers classes ;)
that's due to absense of modules in C/C++. and namespaces aren't of big
help here too. and, of c
On Tuesday, 13 January 2015 at 16:43:09 UTC, ketmar via
Digitalmars-d-learn wrote:
On Tue, 13 Jan 2015 16:17:51 +
aldanor via Digitalmars-d-learn
wrote:
This discussion:
http://forum.dlang.org/thread/bqtcdpsopxmnfbjyr...@forum.dlang.org
-- led me wondering if it would be possible to cre
On Tuesday, 13 January 2015 at 18:12:45 UTC, aldanor wrote:
On Tuesday, 13 January 2015 at 16:43:09 UTC, ketmar via
Digitalmars-d-learn wrote:
On Tue, 13 Jan 2015 16:17:51 +
aldanor via Digitalmars-d-learn
wrote:
This discussion:
http://forum.dlang.org/thread/bqtcdpsopxmnfbjyr...@forum.
On Tue, 13 Jan 2015 18:12:44 +
aldanor via Digitalmars-d-learn
wrote:
> On Tuesday, 13 January 2015 at 16:43:09 UTC, ketmar via
> Digitalmars-d-learn wrote:
> > On Tue, 13 Jan 2015 16:17:51 +
> > aldanor via Digitalmars-d-learn
> >
> > wrote:
> >
> >> This discussion:
> >> http://foru
On Tue, 13 Jan 2015 18:14:40 +
aldanor via Digitalmars-d-learn
wrote:
> // thanks ketmar for answering another one of my stupid questions
> on n.g. :)
ah, 'cmon, your questions aren't stupid at all! ;-)
signature.asc
Description: PGP signature
On Tue, 13 Jan 2015 17:09:31 +
Dominikus Dittes Scherkl via Digitalmars-d-learn
wrote:
> /// interpret an array of one type as an array of a different
> type.
may i point you to this?
import std.stdio;
void main () {
ubyte[] a = [42,0,0,0, 155,2,0,0];
auto b = cast(uint[])a
On Tuesday, 13 January 2015 at 17:08:38 UTC, Laeeth Isharc wrote:
>> I see, thanks! :) I've started liking structs more and
>> more recently as well and been pondering on how to convert
>> a class-based code that looks like this (only the base
>> class has any data):
> it's hard to tell by brie
On Tuesday, 13 January 2015 at 18:19:42 UTC, ketmar via
Digitalmars-d-learn wrote:
and then you can go with structures in the first place, i think.
remember that you have that k00l `alias this` trick for them!
Which doesn't always help in case of multiple inheritance :( e.g.
the blasted hdf c++
On Tue, 13 Jan 2015 18:35:15 +
aldanor via Digitalmars-d-learn
wrote:
> I guess two of my gripes with UFCS is (a) you really have to use
> public imports in the modules where the target types are defined
> so you bring all the symbols in whether you want it or not (b)
> you lose access to
On Tue, 13 Jan 2015 18:36:15 +
aldanor via Digitalmars-d-learn
wrote:
> On Tuesday, 13 January 2015 at 18:19:42 UTC, ketmar via
> Digitalmars-d-learn wrote:
> > and then you can go with structures in the first place, i think.
> > remember that you have that k00l `alias this` trick for them!
>
On Tuesday, 13 January 2015 at 18:25:38 UTC, ketmar via
Digitalmars-d-learn wrote:
On Tue, 13 Jan 2015 17:09:31 +
Dominikus Dittes Scherkl via Digitalmars-d-learn
wrote:
/// interpret an array of one type as an array of a
different type.
may i point you to this?
import std.stdio;
On Tuesday, 13 January 2015 at 20:00:57 UTC, Dominikus Dittes
Scherkl wrote:
So if I have a function that allowes to do this:
uint a;
a.bit[16] = true;
writeln(a); // 65536
Is it also already available?
a |= 1 << 16;
On Tuesday, 13 January 2015 at 13:01:56 UTC, Daniel Kozák via
Digitalmars-d-learn wrote:
What do I need to do/add to avoid auto-decoding here?
std.array.replace(x, `_`, ` `);
Thanks! What about adding See alsos in the docs that relate these
two with respect to auto-decoding?
On Tuesday, 13 January 2015 at 07:35:53 UTC, Nordlöw wrote:
Somewhat related to
https://github.com/D-Programming-Language/phobos/pull/2024
I wonder about the soundness of `map` in
```D
import std.algorithm, std.range, std.stdio;
void main(string[] args)
{
long[] arr;
const n = 3;
On Tuesday, 13 January 2015 at 20:11:45 UTC, anonymous wrote:
On Tuesday, 13 January 2015 at 20:00:57 UTC, Dominikus Dittes
Scherkl wrote:
So if I have a function that allowes to do this:
uint a;
a.bit[16] = true;
writeln(a); // 65536
Is it also already available?
a |= 1 << 16;
Of course y
On Tue, 13 Jan 2015 20:52:13 +
Dominikus Dittes Scherkl via Digitalmars-d-learn
wrote:
> On Tuesday, 13 January 2015 at 20:11:45 UTC, anonymous wrote:
> > On Tuesday, 13 January 2015 at 20:00:57 UTC, Dominikus Dittes
> > Scherkl wrote:
> >> So if I have a function that allowes to do this:
>
anonymous:
a |= 1 << 16;
In D there's also the 2 ^^ x syntax available.
Bye,
bearophile
On Tuesday, 13 January 2015 at 20:52:15 UTC, Dominikus Dittes
Scherkl wrote:
Of course you can calculate it, but the
syntax looks quite different if you want to do
a.bit[22] = false:
a &= ~(1<<16);
Or if you want to test a bit:
if(a.bit[16])
instead of
if(a & (1<<16))
much more convenient f
On Tue, 13 Jan 2015 20:00:56 +
Dominikus Dittes Scherkl via Digitalmars-d-learn
wrote:
p.s. i don't intend to stop you from doing what you want to do, in no
way. i was just trying to show you some things that you can
accidentally missed. sorry if it looks like "stop it, we already have
one an
On Tuesday, 13 January 2015 at 20:30:16 UTC, Nordlöw wrote:
On Tuesday, 13 January 2015 at 13:01:56 UTC, Daniel Kozák via
Digitalmars-d-learn wrote:
What do I need to do/add to avoid auto-decoding here?
std.array.replace(x, `_`, ` `);
Thanks! What about adding See alsos in the docs that rela
On 01/13/15 21:52, Dominikus Dittes Scherkl via Digitalmars-d-learn wrote:
> On Tuesday, 13 January 2015 at 20:11:45 UTC, anonymous wrote:
>> On Tuesday, 13 January 2015 at 20:00:57 UTC, Dominikus Dittes Scherkl wrote:
>>> So if I have a function that allowes to do this:
>>>
>>> uint a;
>>> a.bit[1
Is it possible to
- detect that a lambda is has-side-effects and that
- the map hasn't been used?
Thing is: I'm regularly doing that on purpose.
Actually, isn't your closure even weakly pure in your example,
because arr is part of the closure and thus an argument to it.
On Wednesday, 14 January 2015 at 01:16:54 UTC, Bauss wrote:
Is it possible to access a pointer by its offsets.
Ex. write a 32bit integer to a byte pointer at ex. offset 4.
To give an example in C# you can do this:
fixed (byte* Packet = Buffer) // Buffer would be a byte array
And then to set the
Is it possible to access a pointer by its offsets.
Ex. write a 32bit integer to a byte pointer at ex. offset 4.
To give an example in C# you can do this:
fixed (byte* Packet = Buffer) // Buffer would be a byte array
And then to set the value of a specific offset
*((TYPE*)(Packet + OFFSET))
Wher
On 1/14/2015 10:17 AM, Bauss wrote:
On Wednesday, 14 January 2015 at 01:16:54 UTC, Bauss wrote:
Is it possible to access a pointer by its offsets.
Ex. write a 32bit integer to a byte pointer at ex. offset 4.
To give an example in C# you can do this:
fixed (byte* Packet = Buffer) // Buffer would
62 matches
Mail list logo