Re: Slides share: DMesos - Not only a re-implementation of Mesos

2017-07-12 Thread Patrick Schluter via Digitalmars-d
On Monday, 10 July 2017 at 18:45:34 UTC, Nick Sabalausky 
(Abscissa) wrote:

On 07/10/2017 02:16 PM, Joakim wrote:
I'm actually skeptical of cloud- I think mobile p2p will eat 
most of the cloud-


I've been REALLY hoping p2p will 
eat...cloud^H^H^H^H^Hcentralized internet services[1], but if I 
were a betting man I'd bet heavily against it. For one thing, 
for p2p to kill "cloud" we'd realistically need IPv6 to become 
much more ubiquitous, and that just isn't happening.


And I think the #2 reason IPv6 isn't happening (behind plain 
old inertia) is that it would *allow* p2p to overtake cloud. 
Which brings me to the next reason I don't think p2p will kill 
"cloud": All the big players with all the money and the power 
all LOVE "cloud" because it allows them to hoard more power, 
control and money, whereas p2p would completely destroy that 
frontier for them.


Also, replacing "cloud" with p2p would mean more reliance on 
user's devices actually having decent storage and upload 
bandwidth, but non-power-users (ie the vast majority of people, 
if you don't live in hipster valley) are ambivalent towards 
that, and it would raise the price of their devices, AND they 
don't want to deal with running low on storage, or backing 
things up, so they love "cloud" too.


Both the engineer and the humanitarian in me both REALLY want 
to see p2p eat "cloud", but I just don't see it realistically 
happening.


[1] The word "clould" bugs me to no end. It's the tech sector's 
equivalent to "smurf" - stupid word is used to mean *anything* 
internet-releated, even "internet" itself.


May be this companay can make it happen
http://www.piedpiper.com/
;-)


Re: Hiring D programmers (with cryptography and blockchain knowledge are preferred)

2017-07-12 Thread wigy via Digitalmars-d-announce

On Wednesday, 12 July 2017 at 20:11:06 UTC, Vitor Rozsas wrote:

So... suggestions... Centralized? Decentralized?

I think the centralized wouldn't fit in any country. It would 
certainly contain pedophile posts... and any sane country would 
shut down the servers immediately...


So... DEcentralized?


Hi! I do not think the debate you have with yourself is 
decentralized vs centralized. You are thinking about moderated vs 
unmoderated. One is a technical structure, the other is a social 
one.


We got used to have moderated channels in media and unmoderated 
channels in person. Now the problem we are facing is that we use 
these social media platforms for replacing "in person" 
communications with friend and family. And the owners of these 
platforms are still treating it as "media" that they should 
moderate.


But this is not so black-and-white still. When i am talking to my 
mother-in-law who has different political biases than me, I 
moderate *myself* not to bring up topics that would just divide 
us, because I love her enough to tolerate her opinions. What 
happens is that we have many social circles in which we have 
different topics and ethical norms. This is in our nature and 
that is fine. Football fans ventilate their emotions at the game, 
but they would not use the same language in their workplace.


So what I see is that a social media platform should be 
decentralized to avoid influence from its owner. It should be 
divided into many communities. And each community should be able 
to downvote content that is not tolerated in those circles. And 
downvoted content should be also available by others, it should 
just take more actions to peek into that and convince yourself 
that it was indeed something inapt for that community.


In the digital world, everything seems to be black and white. But 
social behaviors are more subtle than that. It is easy to create 
a total dictatorial system like facebook, and it is also easy to 
create a total anarchist system like Silk Road. And our goal is 
to create a system that is similar to in-real-life communication, 
which is neither completely free, nor completely controlled.


You cannot build that system on top of a centralized architecture 
where a government can just ask for all data including a order to 
keep that secret. People never trusted their inner thoughts or 
family conversation onto the government. And they should not.


Re: Whats the correct way to pass a D array type to a win32 api function wanting a buffer?

2017-07-12 Thread Adam D. Ruppe via Digitalmars-d-learn

On Thursday, 13 July 2017 at 01:15:46 UTC, FoxyBrown wrote:

auto EnumServices()


I wouldn't use auto here. The reason you get mismatch types on 
return here since you don't return consistent types inside.




ENUM_SERVICE_STATUS_PROCESS[5000] services;


Are you sure you are getting the same A vs W version there? You 
explicitly call the A version of the function, but do not specify 
it here.



auto s = services[i].lpServiceName;
writeln(*s);


Like the other user above said, you should be treating that like 
a C string anyway. Use printf or fromStringz or slice it 
yourself... just make sure you tend to char vs wchar like above.



return services;


That's kinda hideous, returning the entire buffer by value. I do 
NOT recommend you attempt to slice and dup though, since the 
win32 function uses space at the end of the buffer to store the 
strings referenced by the structs.


Ideally, you'd avoid returning this thing at all and just use it 
locally. Perhaps pass a callback function/delegate that takes 
each item as you iterate through.


Re: Whats the correct way to pass a D array type to a win32 api function wanting a buffer?

2017-07-12 Thread Nicholas Wilson via Digitalmars-d-learn

On Thursday, 13 July 2017 at 01:15:46 UTC, FoxyBrown wrote:
Everything I do results in some problem, I've tried malloc but 
then converting the strings resulted in my program becoming 
corrupted.



Heres the code:

auto EnumServices()
{

auto schSCManager = OpenSCManager(null, null, 
SC_MANAGER_ALL_ACCESS);

if (NULL == schSCManager)
{
print("OpenSCManager failed (%d)\n", GetLastError());
return null; // Why can't we return a null? Surely we 
don't have to cast a null in to a typeof null?

}

import core.stdc.stdlib;

DWORD dwBytesNeeded, dwCount, lpResumeHandle, resume;

	auto servicesType = (SERVICE_DRIVER | 
SERVICE_FILE_SYSTEM_DRIVER | SERVICE_KERNEL_DRIVER | 
SERVICE_WIN32 | SERVICE_WIN32_OWN_PROCESS | 
SERVICE_WIN32_SHARE_PROCESS);




ENUM_SERVICE_STATUS_PROCESS[5000] services;
	auto res = SVC.EnumServicesStatusExA(schSCManager, 
SC_ENUM_TYPE.SC_ENUM_PROCESS_INFO, servicesType, 
SERVICE_STATE_ALL, cast(ubyte*)services.ptr, 
5000*ENUM_SERVICE_STATUS_PROCESS.sizeof, , 
, , cast(const(char)*)null);



for(int i = 0; i < dwCount; i++)
{
auto s = services[i].lpServiceName;
writeln(*s);
}


return services;
}


What is the signature of the function you are trying to call? 
(make sure its correct :))

Allocating 5000 services may blow your stack.
you can just use `services.sizeof` instead of 
`5000*ENUM_SERVICE_STATUS_PROCESS.sizeof`.
You are returning that massive static array, remember that static 
arrays are value types in D so that will get copied. Consider 
allocating the array and returning a slice of it.


Note also that `lpServiceName` is probably a `char*` so 
drefferencing will give you a char, not a string. Use 
std.string.fromStringz(?) for that.


Re: CTFE Status 2

2017-07-12 Thread H. S. Teoh via Digitalmars-d
On Thu, Jul 13, 2017 at 01:23:53AM +, Stefan Koch via Digitalmars-d wrote:
> On Wednesday, 12 July 2017 at 21:05:28 UTC, watcher wrote:
> > 
> > stop advertising yourself and polluting this thread.
> > seek help - no down-payments in Germany!!
> 
> I am not sure what you mean ...
> I assume it's a joke ?

Or a troll.  Just ignore it.


T

-- 
Debian GNU/Linux: Cray on your desktop.


Re: CTFE Status 2

2017-07-12 Thread Stefan Koch via Digitalmars-d

On Wednesday, 12 July 2017 at 21:05:28 UTC, watcher wrote:


stop advertising yourself and polluting this thread.
seek help - no down-payments in Germany!!


I am not sure what you mean ...
I assume it's a joke ?

If you are indeed offering help, you can reproduce this by 
checking out

https://github.com/UplinkCoder/dmd/tree/newCTFE_on_master
and compiling tests/runnable/template8.d


Whats the correct way to pass a D array type to a win32 api function wanting a buffer?

2017-07-12 Thread FoxyBrown via Digitalmars-d-learn
Everything I do results in some problem, I've tried malloc but 
then converting the strings resulted in my program becoming 
corrupted.



Heres the code:

auto EnumServices()
{

auto schSCManager = OpenSCManager(null, null, 
SC_MANAGER_ALL_ACCESS);

if (NULL == schSCManager)
{
print("OpenSCManager failed (%d)\n", GetLastError());
return null; // Why can't we return a null? Surely we 
don't have to cast a null in to a typeof null?

}

import core.stdc.stdlib;

DWORD dwBytesNeeded, dwCount, lpResumeHandle, resume;

	auto servicesType = (SERVICE_DRIVER | SERVICE_FILE_SYSTEM_DRIVER 
| SERVICE_KERNEL_DRIVER | SERVICE_WIN32 | 
SERVICE_WIN32_OWN_PROCESS | SERVICE_WIN32_SHARE_PROCESS);




ENUM_SERVICE_STATUS_PROCESS[5000] services;
	auto res = SVC.EnumServicesStatusExA(schSCManager, 
SC_ENUM_TYPE.SC_ENUM_PROCESS_INFO, servicesType, 
SERVICE_STATE_ALL, cast(ubyte*)services.ptr, 
5000*ENUM_SERVICE_STATUS_PROCESS.sizeof, , 
, , cast(const(char)*)null);



for(int i = 0; i < dwCount; i++)
{
auto s = services[i].lpServiceName;
writeln(*s);
}


return services;
}


Re: 2D game physics, macOS

2017-07-12 Thread Joel via Digitalmars-d-learn

On Wednesday, 12 July 2017 at 12:05:33 UTC, Jacob Carlborg wrote:

On 2017-07-12 12:18, Joel wrote:

Is there a 2D physics library I can use on macOS, with D?

I already use a multimedia library for graphics, sound and 
input.


Box2D [1] perhaps. I think I've seen bindings for it, somewhere.

[1] http://box2d.org


It doesn't look like there's any thing I can use. I've come 
across: dbox, dchip, and blaze.  Blaze is dsource. dbox is alpha 
and hasn't been updated for 3 years. dchip [1] hasn't been 
updated for 2 years and doesn't compile (that's with out using 
any thing, just import and dub dependency).


[1] https://github.com/d-gamedev-team/dchip


[Issue 17643] New: std.traits.getSymbolsByUDA doesn't work with private attributes

2017-07-12 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17643

  Issue ID: 17643
   Summary: std.traits.getSymbolsByUDA doesn't work with private
attributes
   Product: D
   Version: D2
  Hardware: All
OS: All
Status: NEW
  Severity: normal
  Priority: P1
 Component: phobos
  Assignee: nob...@puremagic.com
  Reporter: greensunn...@gmail.com

There's currently a publicly documented example about using getSymbolsByUDA
with private attributes. This only works because the example is in std.traits 

> dmd -c test.d
tuple(a)

---
import std.traits;

enum Attr;
struct A
{
@Attr int a;
@Attr private int c;
}

pragma(msg, getSymbolsByUDA!(A, Attr).stringof);
---

--


Re: Error on negating unsigned types

2017-07-12 Thread Walter Bright via Digitalmars-d

On 7/11/2017 12:46 PM, Johan Engelen wrote:
So, adding the error may be nice, but it would make generic code a little more 
verbose.


The particular issue you were having appears to be a bug in the compiler (I 
already filed it as a bug report). Being a bug, we need more evidence that 
adding an error for -u is compelling.


There really isn't a comprehensive solution for mistakes using unsigned. Some 
languages deal with the issue by not having an unsigned type at all (Java). At 
some level, it's necessary to just be aware of different integer sizes, integral 
promotion rules, what happens with overflows, and sign.


[Issue 11997] rdmd should search it's binary path for the compiler

2017-07-12 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=11997

Vladimir Panteleev  changed:

   What|Removed |Added

   Keywords||pull

--- Comment #2 from Vladimir Panteleev  ---
https://github.com/dlang/tools/pull/250

--


[Issue 17630] DMD treats imports as public imports when selectively imported

2017-07-12 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17630

--- Comment #2 from Seb  ---
> Can you investigate this a bit more and add that info to the bug report, 
> including that it's been around for a while?


The leaked symbols are [found in the local `symtab`
table](https://github.com/dlang/dmd/blob/master/src/ddmd/dsymbol.d#L1306)

```
test17630b.ScopeDsymbol::search(ident='Erase', flags=x0)
found in locals = 'test17630b.Erase'
test17630b.ScopeDsymbol::search(ident='Erase', flags=x28)
found in locals = 'test17630b.Erase'
```

However, the next four lines in the log shouldn't happen:

```
test17630a.ScopeDsymbol::search(ident='Erase', flags=x0)
found in locals = 'test17630a.Erase'
test17630a.ScopeDsymbol::search(ident='Erase', flags=x28)
found in locals = 'test17630a.Erase'
__anonymous.ScopeDsymbol::search(ident='Erase', flags=x8)
found in locals = '__anonymous.Erase'
```

Now, when I look at the symbol table for test17630b it's built correctly:

```
DsymbolTable::insert(this = 0x7fc6d7dcbbe0, 'object')
DsymbolTable::insert(this = 0x7fc6d7dcbbe0, 'Erase')
DsymbolTable::insert(this = 0x7fc6d7dcbbe0, 'NoErase')
```

In fact even the members only get added for test17630b:

```
Import.addMember(this=object, sd=test17630b, sc=0x7f11f8e71b00)
Dsymbol::addMember('object')
Dsymbol::addMember(this = 0x7f11f8e71c20, 'object' scopesym = 'test17630b')
Dsymbol::addMember(this = 0x7f11f8e71c20, 'object' sds = 0x7f11fa2c2db0,
sds.symtab = 0x7f11f8e71d30)
Dsymbol::addMember('Erase')
Dsymbol::addMember(this = 0x7f11fa2c3aa0, 'Erase' scopesym = 'test17630b')
Dsymbol::addMember(this = 0x7f11fa2c3aa0, 'Erase' sds = 0x7f11fa2c2db0,
sds.symtab = 0x7f11f8e71d30)
Dsymbol::addMember('NoErase')
Dsymbol::addMember(this = 0x7f11fa2c3c60, 'NoErase' scopesym = 'test17630b')
Dsymbol::addMember(this = 0x7f11fa2c3c60, 'NoErase' sds = 0x7f11fa2c2db0,
sds.symtab = 0x7f11f8e71d30)
```

and in the main test file `Erase` doesn't get inserted into the symbol table:

```
__anonymous.ScopeDsymbol::search(ident='_Dmain', flags=x8)
__entrypoint.ScopeDsymbol::search(ident='_Dmain', flags=x28)
found in locals = '__entrypoint._Dmain'
Import::semantic('imports.test17630a.object') object
test17630a.ScopeDsymbol::importScope(object, 2)
Import::semantic('imports.test17630a.imports') test17630b
test17630a.ScopeDsymbol::importScope(test17630b, 2)
Import::semantic('imports.test17630b.object') object
test17630b.ScopeDsymbol::importScope(object, 2)
DsymbolTable::insert(this = 0x7f975b424780, 'fail17630')
DsymbolTable::insert(this = 0x7f975b424850, 'imports')
DsymbolTable::insert(this = 0x7f975b424920, 'imports')
DsymbolTable::insert(this = 0x7f975b4249f0, 'fail17630')
Import::semantic('__anonymous') test17630a
Import::load('__anonymous') 0x7f975c8294b0
```


> This seems like a fairly important import leak remaining, would be good to 
> explore how large it is. 

It's _pretty_ large. AFAICT all module-level imports, non-selective imports
leak their symbols.
However, even selective imports leak their selected symbols:

```d
import imports.test17630b; // works __falsely__ as public import
import imports.test17630b : Erase; // works __falsely__ as public import
```

Funnily even `private import X;` doesn't fix it.

--


Re: Error on negating unsigned types

2017-07-12 Thread Johan Engelen via Digitalmars-d
On Wednesday, 12 July 2017 at 20:12:03 UTC, Steven Schveighoffer 
wrote:

...
Which means this may cause a bunch of nuisance errors.


It's a trade-off between nuisance in some cases (the Phobos ones 
can be solved with val = abs(val), or with static if), and 
possibly catching bugs in other cases.


We can compare this with negation of a bool and subtracting a 
bool:

```
bool b;
auto x = 1 - b; // allowed
auto y = -b; // not allowed
```



Re: CTFE Status 2

2017-07-12 Thread watcher via Digitalmars-d

On Wednesday, 12 July 2017 at 18:57:12 UTC, Stefan Koch wrote:
On Thursday, 16 February 2017 at 21:05:51 UTC, Stefan Koch 
wrote:

[ ... ]


Another ABI issue just pooped on my Wednesday.

this time it manifests while doing concatenation inside a 
template

the test failing is (test/runnable/template8.d)

This is again hard to debug because I have to piece together 
the actual source-code which is being executed.


templates are a pain in the butt!


stop advertising yourself and polluting this thread.
seek help - no down-payments in Germany!!


[Issue 17630] DMD treats imports as public imports when selectively imported

2017-07-12 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17630

--- Comment #1 from Seb  ---


Without the selective import:

test17630a.ScopeDsymbol::search(ident='Erase', flags=x0)
object.ScopeDsymbol::search(ident='Erase', flags=x1)
test17630b.ScopeDsymbol::search(ident='Erase', flags=x1)
found in locals = 'test17630b.Erase'
test17630a.ScopeDsymbol::search(ident='Erase', flags=x28)
test17630a.ScopeDsymbol::search(ident='Erase', flags=x30)
test17630a.ScopeDsymbol::search(ident='Erase', flags=x28)
test17630a.ScopeDsymbol::search(ident='Erase', flags=x30)
__anonymous.ScopeDsymbol::search(ident='Erase', flags=x8)
found in locals = '__anonymous.Erase'



With the selective import in foo:

__anonymous.ScopeDsymbol::search(ident='Erase', flags=x8)
__anonymous.ScopeDsymbol::search(ident='Erase', flags=x8)
fail17630.ScopeDsymbol::search(ident='Erase', flags=x28)
__anonymous.ScopeDsymbol::search(ident='Erase', flags=x28)
__anonymous.ScopeDsymbol::search(ident='Erase', flags=x10)
test17630a.ScopeDsymbol::search(ident='Erase', flags=x1)
__anonymous.ScopeDsymbol::search(ident='Erase', flags=x10)
fail17630.ScopeDsymbol::search(ident='Erase', flags=x30)
object.ScopeDsymbol::search(ident='Erase', flags=x1)
...
fail_compilation/fail17630.d(11): Error: undefined identifier Erase


With a selective import of another symbol in bar:


test17630b.ScopeDsymbol::search(ident='NoErase', flags=x0)
found in locals = 'test17630b.NoErase'
test17630b.ScopeDsymbol::search(ident='NoErase', flags=x28)
found in locals = 'test17630b.NoErase'
test17630a.ScopeDsymbol::search(ident='Erase', flags=x0)
object.ScopeDsymbol::search(ident='Erase', flags=x1)
test17630a.ScopeDsymbol::search(ident='Erase', flags=x2)
object.ScopeDsymbol::search(ident='Erase', flags=x3)
test17630a.ScopeDsymbol::search(ident='Erase', flags=x2)
object.ScopeDsymbol::search(ident='Erase', flags=x3)
test17630a.ScopeDsymbol::search(ident='Erase', flags=x2)
object.ScopeDsymbol::search(ident='Erase', flags=x3)
test17630a.ScopeDsymbol::search(ident='Erase', flags=x2)
fail_compilation/fail17630.d(9): Error: module imports.test17630a import
'Erase' not found, did you mean alias 'NoErase'?


Full test case for the DMD test suite:

diff --git a/test/fail_compilation/fail17630.d
b/test/fail_compilation/fail17630.d
new file mode 100644
index 0..08fe72a36
--- /dev/null
+++ b/test/fail_compilation/fail17630.d
@@ -0,0 +1,12 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail17630.d(12): Deprecation: imports.test17630a.Erase is not
visible from module fail17630
+---
+*/
+void main()
+{
+import imports.test17630a : Erase;
+//import imports.test17630a; // A non-selective import correctly errors
+assert(Erase == 2);
+}
diff --git a/test/fail_compilation/imports/test17630a.d
b/test/fail_compilation/imports/test17630a.d
new file mode 100644
index 0..68003b1f9
--- /dev/null
+++ b/test/fail_compilation/imports/test17630a.d
@@ -0,0 +1,4 @@
+module imports.test17630a;
+//import imports.test17630b; // works __falsely__ as public import
+//import imports.test17630b : Erase; // <- works __falsely__ as public import
+import imports.test17630b : NoErase; // <- works correctly as private import
diff --git a/test/fail_compilation/imports/test17630b.d
b/test/fail_compilation/imports/test17630b.d
new file mode 100644
index 0..c02f4f88a
--- /dev/null
+++ b/test/fail_compilation/imports/test17630b.d
@@ -0,0 +1,3 @@
+module imports.test17630b;
+int Erase = 2;
+int NoErase = 3;

--


Re: Hiring D programmers (with cryptography and blockchain knowledge are preferred)

2017-07-12 Thread Vitor Rozsas via Digitalmars-d-announce

On Wednesday, 12 July 2017 at 20:06:02 UTC, Vitor Rozsas wrote:

On Wednesday, 12 July 2017 at 20:04:58 UTC, Vitor Rozsas wrote:

On Wednesday, 12 July 2017 at 19:37:01 UTC, Vitor Rozsas wrote:

[...]


People... I seriously don't know what to do... Continue with 
the decentralized, but very likely to have pedophilic content 
and users version, or go to a centralized, written in D and 
open-sourced version?


This Gab and this Dreamwidth seem to be proprietary aren't 
they? I didn't a link for their sources...


I want it to be opensource. And written in D. <- Those are 
very important...


Ah, sorry. I just found one of the sources. :P


Dreamwidth seems to be Pearl. Again... I need D. I want this 
language to grow more and more... And the fastest way is to make 
it famous, known (by creating interesting projects in D). :)


So... suggestions... Centralized? Decentralized?

I think the centralized wouldn't fit in any country. It would 
certainly contain pedophile posts... and any sane country would 
shut down the servers immediately...


So... DEcentralized?


Re: Error on negating unsigned types

2017-07-12 Thread Steven Schveighoffer via Digitalmars-d

On 7/12/17 11:00 AM, Andrei Alexandrescu wrote:

On 07/11/2017 03:46 PM, Johan Engelen wrote:
So, adding the error may be nice, but it would make generic code a 
little more verbose.

Ideas? People OK with that?


A compelling argument is that the rule exposed two bugs in Phobos. -- 
Andrei




Those aren't bugs, they are false negatives (pun?).

``` (std.format.formatIntegral)
T arg = val;

immutable negative = (base == 10 && arg < 0);
if (negative) // will always be false for unsigned types
{
arg = -arg;
}
```

``` (std.conv.toTextRange)
T value;

bool negative = value < 0; // also will always be false
Unqual!(Unsigned!T) v = negative ? -value : value;
```

Not sure if the compiler can figure that out. Which means this may cause 
a bunch of nuisance errors.


-Steve


Re: Hiring D programmers (with cryptography and blockchain knowledge are preferred)

2017-07-12 Thread Vitor Rozsas via Digitalmars-d-announce

On Wednesday, 12 July 2017 at 20:04:58 UTC, Vitor Rozsas wrote:

On Wednesday, 12 July 2017 at 19:37:01 UTC, Vitor Rozsas wrote:

[...]


People... I seriously don't know what to do... Continue with 
the decentralized, but very likely to have pedophilic content 
and users version, or go to a centralized, written in D and 
open-sourced version?


This Gab and this Dreamwidth seem to be proprietary aren't 
they? I didn't a link for their sources...


I want it to be opensource. And written in D. <- Those are very 
important...


Ah, sorry. I just found one of the sources. :P


Re: Hiring D programmers (with cryptography and blockchain knowledge are preferred)

2017-07-12 Thread Vitor Rozsas via Digitalmars-d-announce

On Wednesday, 12 July 2017 at 19:37:01 UTC, Vitor Rozsas wrote:

On Wednesday, 12 July 2017 at 04:55:45 UTC, Vitor Rozsas wrote:

On Wednesday, 12 July 2017 at 04:40:16 UTC, Vitor Rozsas wrote:

[...]


If you have any price proposal, please tell me.

* I will not participate directly in the project. I still 
didn't learn D enough to aventurate in a big project like this 
one...


People... It just came to mind... it's a very bad idea to make 
an incensurable social media. It would be a safe heaven for 
pedophiles, drug traffickers, human traffickers, hitmen and 
criminals alike.


I will create another topic in the forum, but for another 
project (way easier to be done, by the way - with vibe.d, no 
blockchain, no big cryptographic use...).
It will be a centralized social media (like any other social 
media - a normal website, with normal apps... and SOME 
moderation/control).
Again: *Some* control. And this control has to be limited by 
all means. And I may know how...


I will post the link to the new project details as a reply 
here. Please, wait.



*I know that a few of you might be saying that I might being 
blackmailed or even bribed to stop the original project, but 
no. I really think a 100% uncontrollable social media could be 
disastrous and dangerous. Some moderation is necessary, even if 
it is just to stop criminals like the mentioned ones.

Sorry if I disappointed you.

But still, it will be done completely in D with vibe.d (app MAY 
BE in D too, if we manage to do them in D - I'm talking about 
Android; iOS in no way has support to it, officially or not. 
But I plan to have an app for them).


And everything will be opensourced, first functioning version 
will be paid (same scheme as before).


People... I seriously don't know what to do... Continue with the 
decentralized, but very likely to have pedophilic content and 
users version, or go to a centralized, written in D and 
open-sourced version?


This Gab and this Dreamwidth seem to be proprietary aren't they? 
I didn't a link for their sources...


I want it to be opensource. And written in D. <- Those are very 
important...


Re: Help me fix my compiler

2017-07-12 Thread Andrew Edwards via Digitalmars-d-learn

On Wednesday, 12 July 2017 at 12:05:17 UTC, Namal wrote:

Hello,

I used the Install Script command line to install the newest 
dmd compiler (Ubuntu 16.04.2 LTS). Now I have to type 'source 
~/dlang/dmd-2.074.1/activate' before I can use it and it is 
also not show in the software center like it used to be. How 
can I fix it or how can I remove it?


Thx


You are using the script directly from dlang.org, as such you can 
manipulate (manage) your installed compilers directly from the 
shell. And not just DMD, it also manages LDC and GDC.


dmd|gdc|ldc   latest version of a compiler
dmd|gdc|ldc- specific version of a compiler (e.g. 
dmd-2.071.1, ldc-1.1.0-beta2)

dmd|ldc-beta  latest beta version of a compiler
dmd-nightly   latest dmd nightly
dmd-2016-08-08specific dmd nightly

To uninstall any compiler previously installed via this script 
simply type ~/dlang/install.sh uninstall 


install.sh uninstall dmd
install.sh uninstall dmd-2.071.1
install.sh uninstall ldc-1.1.0-beta2

To install a different version of the compiler type 
~/dlang/install.sh uninstall 


install.sh install dmd
install.sh install dmd-2.071.1
install.sh install ldc-1.1.0-beta2

To make the 'source ~/dlang/dmd-2.074.1/activate' persistent, 
simply store it in ~/.bash_profile. If this file does not already 
exist, simply create it.


Best of luck.
Andrew


Re: Hiring D programmers (with cryptography and blockchain knowledge are preferred)

2017-07-12 Thread Vitor Rozsas via Digitalmars-d-announce

On Wednesday, 12 July 2017 at 04:55:45 UTC, Vitor Rozsas wrote:

On Wednesday, 12 July 2017 at 04:40:16 UTC, Vitor Rozsas wrote:
* First of all, does Dlang.org have it's own website for 
hiring D programmers or offering D programming services? If 
not, it should!


[...]


If you have any price proposal, please tell me.

* I will not participate directly in the project. I still 
didn't learn D enough to aventurate in a big project like this 
one...


People... It just came to mind... it's a very bad idea to make an 
incensurable social media. It would be a safe heaven for 
pedophiles, drug traffickers, human traffickers, hitmen and 
criminals alike.


I will create another topic in the forum, but for another project 
(way easier to be done, by the way - with vibe.d, no blockchain, 
no big cryptographic use...).
It will be a centralized social media (like any other social 
media - a normal website, with normal apps... and SOME 
moderation/control).
Again: *Some* control. And this control has to be limited by all 
means. And I may know how...


I will post the link to the new project details as a reply here. 
Please, wait.



*I know that a few of you might be saying that I might being 
blackmailed or even bribed to stop the original project, but no. 
I really think a 100% uncontrollable social media could be 
disastrous and dangerous. Some moderation is necessary, even if 
it is just to stop criminals like the mentioned ones.

Sorry if I disappointed you.

But still, it will be done completely in D with vibe.d (app MAY 
BE in D too, if we manage to do them in D - I'm talking about 
Android; iOS in no way has support to it, officially or not. But 
I plan to have an app for them).


And everything will be opensourced, first functioning version 
will be paid (same scheme as before).


[Issue 17193] selective imports -> deprecation warnings even if symbol is not used

2017-07-12 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17193

Vladimir Panteleev  changed:

   What|Removed |Added

   Keywords||diagnostic, rejects-valid

--- Comment #1 from Vladimir Panteleev  ---
Same with a fully qualified import (`static import foo; foo.toUTF8("aoeu");` in
your example).

--


Re: CTFE Status 2

2017-07-12 Thread Stefan Koch via Digitalmars-d

On Thursday, 16 February 2017 at 21:05:51 UTC, Stefan Koch wrote:

[ ... ]


Another ABI issue just pooped on my Wednesday.

this time it manifests while doing concatenation inside a template
the test failing is (test/runnable/template8.d)

This is again hard to debug because I have to piece together the 
actual source-code which is being executed.


templates are a pain in the butt!



Re: Static array with parameter based size?

2017-07-12 Thread Jack Applegame via Digitalmars-d-learn

On Wednesday, 12 July 2017 at 05:45:13 UTC, Miguel L wrote:
Also what is it possible in D to write a function that accepts 
an static array of any size?


void foo(size_t N)(ref int[N] arr) {
...
}

int[10] arr;
foo(arr);



[Issue 17642] New: Specify in the documentation for destructors the problem with the error InvalidMemoryOperationError

2017-07-12 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17642

  Issue ID: 17642
   Summary: Specify in the documentation for destructors the
problem with the error InvalidMemoryOperationError
   Product: D
   Version: D2
  Hardware: All
OS: All
Status: NEW
  Severity: enhancement
  Priority: P1
 Component: dlang.org
  Assignee: nob...@puremagic.com
  Reporter: criman...@gmail.com

The current implementation of GC is not re-enterable so users regularly receive
an unexpected InvalidMemoryOperationError. The only reliable way to avoid this
error is not to create garbage-collected instances of objects or structs with
non-@nogc destructor. There is no information about it in the documentation,
except error itself description. Nobody reads all possible errors descriptions
before writing code. So then user faced this error usually it's too late to
change architecture and think about ~this() @nogc.

So I propose to add info about this error and how to avoid this to destructors
documentation page 
https://dlang.org/spec/class.html#destructors
or as minimum write a short warning about and give the link to the page with
extended info https://wiki.dlang.org/InvalidMemoryOperationError

--


[Issue 16432] JSON incorrectly parses to string

2017-07-12 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16432

Tomer Filiba (weka)  changed:

   What|Removed |Added

 CC|to...@weka.io   |

--


Re: Foreign threads in D code.

2017-07-12 Thread Igor Shirkalin via Digitalmars-d-learn
On Wednesday, 12 July 2017 at 09:49:32 UTC, Guillaume Piolat 
wrote:

On Tuesday, 11 July 2017 at 22:59:42 UTC, Igor Shirkalin wrote:

[...]


--
  Biotronic


Thanks for very useful information!


Just one small note.
If you don't know the foreign thread lifetime, it's cleaner to 
detach it from the runtime upon exit.


Else may fall in the following scenario.
1. you register thread A
2. thread A is destroyed later on, in the C++ code
3. another thread B come into your callback and allocate. The 
GC triggers and try to pause a non-existing thread A.


This is important note. Yes, usually the lifetime of foreign 
thread is unknown.


You, guys, helped me a lot.



[Issue 12736] @nogc std.algorithm.all

2017-07-12 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=12736

Jon Degenhardt  changed:

   What|Removed |Added

 CC||jrdemail2000-dl...@yahoo.co
   ||m

--- Comment #2 from Jon Degenhardt  ---
Seems a legitimate enhancement request, and in line with the longer term goal
of having Phobos be @nogc when possible. In this particular case, there doesn't
appear to be any reason why the functionality implemented by std.algorithm.all
cannot be @nogc. And, std.algorithm.find could be @nogc as well in this case.

Personally though, I would hesitate to write an enhancement request against
each individual function in Phobos for every attribute, and instead have a
larger placeholder ticket for larger blocks of Phobos, for example, a ticket
for all of std.algorithm. The above is a policy question of course, but if done
this way then this ticket could be closed as a duplicate of the larger ticket,
rather than closing it as invalid.

As aside: std.algorithm.find is @nogc for certain argument types. Example:

@nogc @safe nothrow pure unittest
{
import std.algorithm : find;
import std.range : iota;

assert(find(iota(1,5), 3) == iota(3,5));
}

--


[Issue 7839] std.range.countFrom() too

2017-07-12 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=7839

Seb  changed:

   What|Removed |Added

 CC||greensunn...@gmail.com

--- Comment #4 from Seb  ---
Wouldn't it make sense to add support for BigInt to iota instead of creating
yet another range?

--


[Issue 16989] Ensure that every Phobos function has Returns/Params

2017-07-12 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16989

Seb  changed:

   What|Removed |Added

 CC||greensunn...@gmail.com

--- Comment #1 from Seb  ---
DScanner now supports partial blacklisting and
`properly_documented_public_functions` can be fixed modulewise.

--


[Issue 17640] std.concurrenct writeln conflicts with std.stdio writeln in unittests

2017-07-12 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17640

--- Comment #1 from github-bugzi...@puremagic.com ---
Commits pushed to master at https://github.com/dlang/phobos

https://github.com/dlang/phobos/commit/a5afe1609feed83f2233cad80a54201dccdd4b1e
Fix Issue 17640 - std.concurrenct writeln conflicts with std.stdio writeln in
unittests

https://github.com/dlang/phobos/commit/72c1c2bc3a27f529128a453bc8327a76cd162e2f
Merge pull request #5600 from wilzbach/fix-17640

Fix Issue 17640 - std.concurrenct writeln conflicts with std.stdio writeln in
unittests
merged-on-behalf-of: Jack Stouffer 

--


[Issue 17640] std.concurrenct writeln conflicts with std.stdio writeln in unittests

2017-07-12 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17640

github-bugzi...@puremagic.com changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |FIXED

--


[Issue 16432] JSON incorrectly parses to string

2017-07-12 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16432

Seb  changed:

   What|Removed |Added

   Keywords||pull
 CC||greensunn...@gmail.com

--


Re: Call for arms: Arch Linux D package maintenance

2017-07-12 Thread Wild via Digitalmars-d-announce

On Monday, 10 July 2017 at 23:39:36 UTC, rjframe wrote:
I couldn't find a documented deprecation process, but they do 
deprecate packages; perhaps if that could be pushed forward it 
would allow someone to maintain something in AUR.


I can maintain the packages if they are moved to the AUR. I 
maintain most of the

dlang packages in there already. [1]

I been thinking of applying to become a TU, but haven't gotten 
around to do it. (I will probably do this in the future if needed)


[1] https://aur.archlinux.org/packages/?K=dlang


[Issue 16783] std.net.curl application throws an exception

2017-07-12 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16783

Seb  changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 CC||greensunn...@gmail.com
 Resolution|--- |WORKSFORME

--- Comment #3 from Seb  ---
I ran your program 15x on my machine with 2.074.0 and 2.075.0-b4 and couldn't
reproduce this. Closing this as WORKSFORME then - please reopen if this is
still an issue for you with the latest release.

--


[Issue 17040] Examples should have an import of itself

2017-07-12 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17040

Seb  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 CC||greensunn...@gmail.com
 Resolution|--- |FIXED

--- Comment #2 from Seb  ---
Since a couple of weeks we have a export button on the right which takes you to
run.dlang.io (and interactive playground). On export the current module +
std.stdio are imported and the code is wrapped into a void main() { ...}, s.t.
it's runnable everywhere.
I am hence closing this as FIXED, please reopen if you disagree and still think
that the examples should have the respective imported modules directly listed
on dlang.org, please reopen.

--


[Issue 16984] Make more modules runnable on dlang.org

2017-07-12 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16984

Seb  changed:

   What|Removed |Added

 CC||greensunn...@gmail.com

--- Comment #1 from Seb  ---
https://github.com/dlang/phobos/pull/5582 reduces the list again and contains a
list of missing modules on the blacklist:

- std.math
- std.stdio
- stdx.allocator.building_blocks.quantizer
- stdx.allocator.building_blocks.free_list
- std.traits

--


[Issue 17082] assert in std.algorithm.iteration splitter example does not compile.

2017-07-12 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17082

Seb  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 CC||greensunn...@gmail.com
 Resolution|--- |WORKSFORME

--- Comment #1 from Seb  ---
Thanks for reporting!

This was probably due to the low RAM of the DPaste backend. We switched to
DTour as backend a few weeks a go and now all examples work online.

Btw on every PR we automatically check that all examples compile, so if you see
a "Temporarily unavailable" that's most likely related to the backend then.

--


[Issue 17107] Runnign phobos unittests do not work with PIE

2017-07-12 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17107

Seb  changed:

   What|Removed |Added

   Keywords||pull
 CC||greensunn...@gmail.com

--- Comment #2 from Seb  ---
https://github.com/dlang/phobos/pull/5586

--


[Issue 17127] bad example code for std.concurrency.Generator

2017-07-12 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17127

Seb  changed:

   What|Removed |Added

   Keywords||pull
 CC||greensunn...@gmail.com

--- Comment #1 from Seb  ---
https://github.com/dlang/phobos/pull/5603

--


[Issue 17641] TypeInfo for two identical delegates (or functions) are not equal to each other

2017-07-12 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17641

ag0ae...@gmail.com changed:

   What|Removed |Added

 CC||ag0ae...@gmail.com

--- Comment #1 from ag0ae...@gmail.com ---
(In reply to andronkin from comment #0)
> auto d1 = delegate void(uint a) { writeln(a); };
> auto d2 = delegate void(uint a) {};
> 
> assert(typeid(d1) is typeid(d2)); // FAILED! Although type hasn't been
> changed...

The type of d1 has changed. Try printing them with `pragma(msg, ...)`:


pragma(msg, typeof(d1));
pragma(msg, typeof(d2));


Prints:


void delegate(uint a) @safe
void delegate(uint a) pure nothrow @nogc @safe


You see that d1 is not `pure nothrow @nogc`. Because `writeln` isn't.

> Also, the string representation of typeid(d1) is "void delegate()", although
> there must be a "void delegate(uint)".

Yeah, that looks wrong.

--


Re: Hiring D programmers (with cryptography and blockchain knowledge are preferred)

2017-07-12 Thread Kagamin via Digitalmars-d-announce

On Wednesday, 12 July 2017 at 14:27:41 UTC, István wrote:
These are still centralized services which any time might 
decide to change to censorship or forced to shut down, then you 
lose access to your content the same way.


I saw 4 such cases and it was always easier to setup a replica. 
And those replacements are already made with replication in mind.


Anything like quote?

2017-07-12 Thread Jean-Louis Leroy via Digitalmars-d-learn
I want to create a string while making sure it qualifies as an 
identifier. Like this:


struct quote
{
  static @property string opDispatch(string str)() { return str; }
}

unittest
{
  assert(quote.foo == "foo");
}

Does it already exist somewhere in the language or the library?

J-L



[Issue 17641] New: TypeInfo for two identical delegates (or functions) are not equal to each other

2017-07-12 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17641

  Issue ID: 17641
   Summary: TypeInfo for two identical delegates (or functions)
are not equal to each other
   Product: D
   Version: D2
  Hardware: All
OS: Windows
Status: NEW
  Severity: major
  Priority: P1
 Component: druntime
  Assignee: nob...@puremagic.com
  Reporter: andron...@gmail.com

Example:

auto d1 = delegate void(uint a) {};
auto d2 = delegate void(uint a) {};

assert(typeid(d1) is typeid(d2)); // OK

But in another case:

auto d1 = delegate void(uint a) { writeln(a); };
auto d2 = delegate void(uint a) {};

assert(typeid(d1) is typeid(d2)); // FAILED! Although type hasn't been
changed...

Also, the string representation of typeid(d1) is "void delegate()", although
there must be a "void delegate(uint)".

--


Re: dmd and Archlinux

2017-07-12 Thread Marco Leise via Digitalmars-d
Am Tue, 11 Jul 2017 06:21:33 -0600
schrieb Jonathan M Davis via Digitalmars-d
:

> On Tuesday, July 11, 2017 12:00:51 PM MDT Seb via Digitalmars-d wrote:
> > @mleise: OP is using the testing repos where the PIE enforcement
> > already landed [1], but libphobos.a isn't built with -fPIC on
> > Arch yet.
> > The Arch developers, however, are aware of the need to rebuild
> > libphobos [2], but maybe we can simply build Phobos with -fPIC by
> > default on Posix [3].
> >
> > [1] https://www.archlinux.org/todo/pie-rebuild
> > [2] https://bugs.archlinux.org/task/54749
> > [3] https://github.com/dlang/phobos/pull/5586  
> 
> PIC and PIE may make sense from security perspective, but they've sure made
> dealing with some the Linux distros over the last year or so a bit of a
> pain.
> 
> - Jonathan M Davis

It adds to security and adds another shovel of dirt on the
grave of x86. X86 needs to emulate access to global constants
in PIE, while amd64 is using offsets relative to the
instruction pointer. RIP x86. (pun intended!)

-- 
Marco



[Issue 5418] std.math.lround not implemented on win32 and not documented

2017-07-12 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=5418

--- Comment #3 from github-bugzi...@puremagic.com ---
Commits pushed to stable at https://github.com/dlang/phobos

https://github.com/dlang/phobos/commit/4ea051f17a1308a92ce93d0cb7e5ea38c2de1e18
Issue 5418 - std.math.lround not implemented on win32 and not documented

https://github.com/dlang/phobos/commit/42c3b6b75159daa9d976933d42a3a4fdd1fa9868
Merge pull request #5599 from RazvanN7/Issue_5418

Issue 5418 - std.math.lround not implemented on win32 and not documented
merged-on-behalf-of: Sebastian Wilzbach 

--


Re: Slides share: DMesos - Not only a re-implementation of Mesos

2017-07-12 Thread 鲜卑拓跋枫 via Digitalmars-d

On Monday, 10 July 2017 at 17:29:01 UTC, 鲜卑拓跋枫 wrote:

Dear all,
   I am a D-language amateur from China, and just want to share 
you with a slides from me that post on MesosCon Asia 
2017(Beijing):
   
https://mesosconasia2017.sched.com/event/AZc6/dmesos-not-only-a-re-implementation-of-mesos-ce-feng-li-emc#
   I do really wanna to implement the design or "dream" as 
described in this slides,

your help and suggestion are very welcome!
   Thanks!

BRs,
Koo



Thanks to your attention!
As this slides exposed: I do have some ideas about implement the 
data center in D language via kernel space/user space/runtime 
repartition and redesign, the corresponding experiments are on 
the way, but many technical challenges still need to be overcome, 
I will update relevant information timely.


Re: Slides share: DMesos - Not only a re-implementation of Mesos

2017-07-12 Thread 鲜卑拓跋枫 via Digitalmars-d

On Monday, 10 July 2017 at 20:45:01 UTC, Andy Smith wrote:

On Monday, 10 July 2017 at 17:29:01 UTC, 鲜卑拓跋枫 wrote:

Dear all,
   I am a D-language amateur from China, and just want to 
share you with a slides from me that post on MesosCon Asia 
2017(Beijing):
   
https://mesosconasia2017.sched.com/event/AZc6/dmesos-not-only-a-re-implementation-of-mesos-ce-feng-li-emc#
   I do really wanna to implement the design or "dream" as 
described in this slides,

your help and suggestion are very welcome!
   Thanks!

BRs,
Koo


Wow - very cool stuff. Wish I could have heard the talk - was 
it recorded at all? D could really benefit from some sort of 
'project X' that will propel it to the next level. (Much like 
rails did for ruby, numpy/pandas did for python, akka/spark for 
scala). A D re-implementation of the mesos/akka/raft stack was 
one of the things that could be it.


Best of luck with the project. I'll be watching it with a lot 
of interest!


Cheers,

A.


In general, the videos of MesosCon will be uploaded to Youtube 
within one or two month. But unfortunately, I gave the talk in 
Chinese since the content of this slides is relatively rich and 
my English is poor:).


Re: .NET Library In D

2017-07-12 Thread 鲜卑拓跋枫 via Digitalmars-d

On Monday, 10 July 2017 at 21:36:05 UTC, FoxyBrown wrote:
I was able to get my C# to D convert to convert about 25% of 
the .net library v4.6


[...]


Would you please publish your C# to D converter? I really need it!


Re: Error on negating unsigned types

2017-07-12 Thread Andrei Alexandrescu via Digitalmars-d

On 07/11/2017 03:46 PM, Johan Engelen wrote:
So, adding the error may be nice, but it would make generic code a 
little more verbose.

Ideas? People OK with that?


A compelling argument is that the rule exposed two bugs in Phobos. -- Andrei



Re: Having a strange issue with std.net.curl.HTTP as a struct dependency

2017-07-12 Thread crimaniak via Digitalmars-d-learn

On Wednesday, 12 July 2017 at 13:47:06 UTC, Adam D. Ruppe wrote:


This tells me the problem is in the collection order at the end 
of the program.

...
So I'd say the answer is prolly to keep HTTP away from the GC. 
Manually free its arrays, or keep them outside arrays in the 
first place.


I'd try also calling GC.collect() manually before the exit.



Re: D Milestones

2017-07-12 Thread jmh530 via Digitalmars-d
On Wednesday, 12 July 2017 at 14:14:02 UTC, Martin Tschierschke 
wrote:


Please post events (even without date) you think are important.



I see a lot of changes from 2.020 to 2.031. That period looks 
like there are a lot of things going on.


Re: D Milestones

2017-07-12 Thread Martin Tschierschke via Digitalmars-d
On Wednesday, 12 July 2017 at 14:16:48 UTC, rikki cattermole 
wrote:

On 12/07/2017 3:14 PM, Martin Tschierschke wrote:


Please post events (even without date) you think are important.
First release of your IDE/Plugin or whatever made you more 
comfortable using D.


Since when is the IRC channel in use?


Since like 2003 when it was registered on Freenode.


Thanks. Just inserted it into the draft.


Re: Hiring D programmers (with cryptography and blockchain knowledge are preferred)

2017-07-12 Thread István via Digitalmars-d-announce

On Wednesday, 12 July 2017 at 12:12:29 UTC, Kagamin wrote:
On Wednesday, 12 July 2017 at 11:11:20 UTC, Steven 
Schveighoffer wrote:
Have you heard of https://gab.ai ? They are doing something 
similar (in terms of providing an uncensored platform).


Another one is dreamwidth.org, it started as a reaction to 
tighter control too and has a permissive content policy.


These are still centralized services which any time might decide 
to change to censorship or forced to shut down, then you lose 
access to your content the same way. Censorship-resistence can 
only be achieved by decentralized networks (like DHT, blockchain, 
etc) which have no classic governance/control and make attacks 
hard.


Re: proposed @noreturn attribute

2017-07-12 Thread Andrei Alexandrescu via Digitalmars-d

On 07/12/2017 05:32 AM, Timon Gehr wrote:

On 09.07.2017 23:45, Meta wrote:

...
Another case that we should probably just statically disallow:
... > This obviously doesn't make any sense anyway
... > I don't see a reason for us to ever need to do that
Sorry, but this thinking has no place in type system design. This is 
precisely how you create a convoluted nonsensical mess.


Timon, I think you're very well positioned to author a DIP on this. 
Getting through acceptance on your static foreach DIP seems to not 
require a lot of extra work.



Every type is peculiar. That's essentially the point of having
types. There is not really a reason to invent a peculiarity ordering
and then add additional special casing for types deemed more
peculiar. (I.e., creating different types of types based on an
informal judgment of peculiarity.)

I seem to recall Haskell calls those "kinds".


In D, subtyping is messy anyway, as you cannot have a subtyping
relationship between values with different memory layout. Hence in D,
Bottom would not actually be a subtype of all other types.


It's a point, and it would make the implementation easier, but it would 
be a departure from theory. Also it makes user code a tad more awkward. 
Consider:


typeof(assert(0)) abort(const(char)[] message);
...
int fun()
{
   int x;
   ...
   return x != 0 ? 1024 / x : abort("Error: calculation went awry.");
}

I guess such expressions can be rewritten into separate statements:

if (x != 0) return 1024 / x;
abort("Error: calculation went awry.");

and then the compiler figures there's no need for a return following the 
call to abort.


Perhaps a solid plan is to start with a DIP that does not introduce 
conversion and then experiment with the result for a while. What do you 
think?



Andrei


Re: D Milestones

2017-07-12 Thread rikki cattermole via Digitalmars-d

On 12/07/2017 3:14 PM, Martin Tschierschke wrote:


Please post events (even without date) you think are important.
First release of your IDE/Plugin or whatever made you more comfortable 
using D.


Since when is the IRC channel in use?


Since like 2003 when it was registered on Freenode.


[Issue 4541] Intrinsic functions do not have pointers

2017-07-12 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=4541

Mathias Lang  changed:

   What|Removed |Added

 Status|RESOLVED|REOPENED
  Component|phobos  |dmd
 Resolution|FIXED   |---

--- Comment #9 from Mathias Lang  ---
I strongly disagree with closing this bug.

> Even though using core.math results in link failure, I do not think this is a 
> problem since that is the runtime library and who uses it should know that 
> the functions declared there are intrinsics.

Relying on user knowing of internal details is not a solution. Moreover, this
doesn't take into account generic code. If one write a template that accept a
static function via a template this argument, do you really expect this person
to handle the case of someone passing an intrinsic explicitly ?

Intrinsics shouldn't differ from regular functions.

> Anyway, this is not a phobos bug anymore and I don't think it is a druntime 
> one either. Closing as fixed.

The correct course of action would be to properly tag the bug as being within
DMD.

--


Re: D Milestones

2017-07-12 Thread Martin Tschierschke via Digitalmars-d

On Wednesday, 12 July 2017 at 13:18:54 UTC, jmh530 wrote:
On Wednesday, 12 July 2017 at 12:40:21 UTC, Martin Tschierschke 
wrote:
On Monday, 26 June 2017 at 18:16:12 UTC, Patrick Schluter 
wrote:

On Monday, 26 June 2017 at 12:58:00 UTC, Andrea Fontana wrote:

On Monday, 26 June 2017 at 10:14:08 UTC, Martin Tschierschke

[...]
So the first version 0.0.1 of this in the Wiki, please help to 
update!


https://wiki.dlang.org/Language_History_and_Future


I would recommend going through the changelogs and picking out 
some key developments. At a minimum, it provides information 
like D 2.0 was released June 17, 2007 (D 1.001 Jan. 23, 2007). 
I don't see much on the prior history.


http://dlang.org/changelog/
http://www.digitalmars.com/d/1.0/changelog.html


Thank you, will do so.

Please post events (even without date) you think are important.
First release of your IDE/Plugin or whatever made you more 
comfortable using D.


Since when is the IRC channel in use?


[Issue 15768] std.stdio.trustedStdout accesses __gshared data without synchronization.

2017-07-12 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=15768

--- Comment #9 from Jack Stouffer  ---
(In reply to John Colvin from comment #8)
> Is this resolved now? I see a fair amount of synchronisation in makeGlobal,
> which is what std{in,out,err} are aliased to now.

Nope. I was able to reproduce this with Phobos master.

--


[Issue 17640] std.concurrenct writeln conflicts with std.stdio writeln in unittests

2017-07-12 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17640

Seb  changed:

   What|Removed |Added

Summary|std.concurrenct writeln |std.concurrenct writeln
   |conflicts std.stdio writeln |conflicts with std.stdio
   |in unittests|writeln in unittests

--


Re: Struct Constructor Lazy

2017-07-12 Thread Adam D. Ruppe via Digitalmars-d-learn

On Wednesday, 12 July 2017 at 11:18:08 UTC, Biotronic wrote:

The traditional solution is static opCall:



That's bug city... the dummy argument is better, or a named 
static factory function.


Foo foo = Foo;
Foo foo = Foo();

those are different with static opCall. It also conflicts with 
constructors and non-static opCall.


[Issue 17640] New: std.concurrenct writeln conflicts std.stdio writeln in unittests

2017-07-12 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17640

  Issue ID: 17640
   Summary: std.concurrenct writeln conflicts std.stdio writeln in
unittests
   Product: D
   Version: D2
  Hardware: x86_64
OS: Linux
Status: NEW
  Severity: major
  Priority: P1
 Component: phobos
  Assignee: nob...@puremagic.com
  Reporter: greensunn...@gmail.com

test/utils.d(100,20): Error: std.stdio.writeln!(string, MapResult!(__lambda4,
APIExpectation[])).writeln at
/home/travis/dlang/dmd-master-2017-07-12/linux/bin64/../../src/phobos/std/stdio.d(3553,6)
conflicts with std.concurrency.writeln!(string, MapResult!(__lambda4,
APIExpectation[])).writeln at
/home/travis/dlang/dmd-master-2017-07-12/linux/bin64/../../src/phobos/std/concurrency.d(48,10)
test/utils.d(259,20): Error: std.stdio.writeln!string.writeln at
/home/travis/dlang/dmd-master-2017-07-12/linux/bin64/../../src/phobos/std/stdio.d(3553,6)
conflicts with std.concurrency.writeln!string.writeln at
/home/travis/dlang/dmd-master-2017-07-12/linux/bin64/../../src/phobos/std/concurrency.d(48,10)
test/utils.d(295,20): Error: std.stdio.writeln!string.writeln at
/home/travis/dlang/dmd-master-2017-07-12/linux/bin64/../../src/phobos/std/stdio.d(3553,6)
conflicts with std.concurrency.writeln!string.writeln at
/home/travis/dlang/dmd-master-2017-07-12/linux/bin64/../../src/phobos/std/concurrency.d(48,10)
test/utils.d(315,20): Error: std.stdio.writeln!string.writeln at
/home/travis/dlang/dmd-master-2017-07-12/linux/bin64/../../src/phobos/std/stdio.d(3553,6)
conflicts with std.concurrency.writeln!string.writeln at
/home/travis/dlang/dmd-master-2017-07-12/linux/bin64/../../src/phobos/std/concurrency.d(48,10)

https://travis-ci.org/dlang-bots/dlang-bot/jobs/252702252

--


Re: Struct Constructor Lazy

2017-07-12 Thread Adam D. Ruppe via Digitalmars-d-learn

On Wednesday, 12 July 2017 at 11:57:33 UTC, Biotronic wrote:

Debug = no optimization.


That's not really true, you can have an optimized debug build.

dmd's -debug, -g, and -O switches are all independent. -debug 
turns on blocks labeled with the `debug` switch in code. -g adds 
info for a debugger to read. -O turns on optimizations.


You can use any combination of those.


Looking at the generated assembly in a debug build is worthless.


I don't agree - looking at the generated assembly would put to 
rest all these questions.


But before doing that, you should show that the performance is 
actually bad. I can't imagine sending a zero argument (whether in 
a register or pushed to the stack) would ever be a serious 
problem.


Re: Cannot dup an associative array but why?

2017-07-12 Thread Jean-Louis Leroy via Digitalmars-d-learn

On Tuesday, 11 July 2017 at 21:23:28 UTC, Ali Çehreli wrote:
Default template and function arguments are resolved at 
instantiation site, which means __MODULE__ would resolve 
automatically to the caller's module. For example, if you have 
this module:


__MODULE__ is a string so I cannot pass it to 
__traits(allMembers). I worked around it via a string mixin that 
creates an alias for the module:


template RegisterMethods()
{
  import std.array;
  mixin("alias MODULE = " ~ __MODULE__ ~ ";");
  auto RegisterMethods() {
string[] s;
foreach (m; __traits(allMembers, MODULE)) {
  // do stuff
}
return join(s, "");
  }
}

mixin(RegisterMethods);

I wonder if there is a better way.

Also, I am using the outer string mixin (as opposed to a plain 
mixin) because I will need to produce a series of aliases:


mixin(RegisterMethods);
// injects:
// alias add = Method!("add", Matrix, virtual!Matrix, 
virtual!Matrix).dispatcher
// alias add = Method!("add", Matrix, virtual!Matrix, 
virtual!Matrix).discriminator;

// alias kick = Method!("kick", Animal).dispatcher
// alias kick = Method!("kick", Animal).discriminator
// etc

The only way I can see is with a string mixin.

I thought about the new syntax since yesterday, and hit some 
problems and some solutions. At this point maybe we should 
continue that discussion elsewhere than the Learn forum...


[Issue 17622] inline for m64 fails web APPS

2017-07-12 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17622

--- Comment #3 from steven kladitis  ---
void main() {
import std.stdio, std.base64, std.net.curl, std.string;

const f = "http://rosettacode.org/favicon.ico".get.representation;
Base64.encode(f).writeln;
}



 the above fails in -m32 or -m64 when using -inline
-- without -inline they  execute immediately.

--


Re: Struct Constructor Lazy

2017-07-12 Thread Adam D. Ruppe via Digitalmars-d-learn

On Wednesday, 12 July 2017 at 11:00:54 UTC, Jiyan wrote:
when A(0) is called I would want here optimal performance, so 
there doesnt even need to be a value pushed on the stack (i=0), 
what would be like having a constructor with zero arguments (i 
is never used!).


This is so, so irrelevant. Even if it isn't optimized out (which 
it probably is), pushing a zero to the stack is so extremely 
cheap that you'd probably not notice it, especially compared to 
reading something from a file.



Im pretty new to D, can somebody tell me how i would do this?
Is this(lazy int i){ ... a solution?


That's actually more expensive than just sending the zero!


Re: Having a strange issue with std.net.curl.HTTP as a struct dependency

2017-07-12 Thread Adam D. Ruppe via Digitalmars-d-learn

On Monday, 10 July 2017 at 00:10:36 UTC, NoBigDeal256 wrote:
The error goes away. The error also goes away if 
ThingA.arrayOfThingBs returns a single instance of ThingB 
instead of an array of ThingB.


This tells me the problem is in the collection order at the end 
of the program.


The HTTP inside the struct inside the array gets cleaned up by 
the garbage collector (aka GC) at program termination... and it 
might be doing that AFTER unloading curl, leading to the 
segfault, OR it could be running some GC operation in the 
destructor, leading to InvalidMemoryOperationError (calling a GC 
function while the GC is running is not allowed). Which you get 
is apparently dependent on which system you are on, but both are 
wrong.


If it isn't in the array, the destructor gets called at scope 
exit, which happens before program termination and outside the 
GC, so everything happens as it is supposed to.



HTTP's innards have a RefCounted implementation which has a 
destructor that calls GC.removeRange. I *think* that can do the 
invalid mem operation. And the implementation itself can do 
curl_shutdown, which is your potential segfault.



So I'd say the answer is prolly to keep HTTP away from the GC. 
Manually free its arrays, or keep them outside arrays in the 
first place.


Re: Function with static array as parameter

2017-07-12 Thread Nicholas Wilson via Digitalmars-d-learn

On Wednesday, 12 July 2017 at 12:20:11 UTC, Miguel L wrote:
What is the best way in D to create a function that receives a 
static array of any length?


Do know that static arrays are passed by value in D, so passing a 
static array of a million elements will copy them...


There are two solutions to this:
1) pass the static array by reference. This will pass a pointer 
to the array and won't copy it although modifying it will modify 
the original. consider passing const ref if the function doesn't 
modify it. Although will still create its of template bloat.
2) pass a slice of the static array. this is essentially the same 
as the above, but you also pass the length of the array as well. 
This means it can accept a slice of a static array of any size 
(or any dynamic array) and since it isn't a template the compiler 
won't make lots of copies for different sized array. This is 
probably he better option.


Re: D Milestones

2017-07-12 Thread Martin Tschierschke via Digitalmars-d

On Wednesday, 12 July 2017 at 13:11:47 UTC, Nicholas Wilson wrote:
On Wednesday, 12 July 2017 at 12:40:21 UTC, Martin Tschierschke 
wrote:
On Monday, 26 June 2017 at 18:16:12 UTC, Patrick Schluter 
wrote:

On Monday, 26 June 2017 at 12:58:00 UTC, Andrea Fontana wrote:

On Monday, 26 June 2017 at 10:14:08 UTC, Martin Tschierschke

[...]
So the first version 0.0.1 of this in the Wiki, please help to 
update!


https://wiki.dlang.org/Language_History_and_Future


If you're looking for more info Leandro's Keynote (DConf 2016?) 
has lots of history.


Yes, thanks: http://dconf.org/2016/talks/lucarella.pdf



Re: Static array with parameter based size?

2017-07-12 Thread Adam D. Ruppe via Digitalmars-d-learn

On Wednesday, 12 July 2017 at 05:45:13 UTC, Miguel L wrote:

void f(int x)
{
int[] my_array;
my_array.length=x;

but I don't really need a dynamic array as length is not going 
to change inside f.


Then just don't change the length... this is a correct way to do 
it.


You could also allocate it with `alloca` or `malloc` depending on 
exact use.


I also sometimes like to just slice a static array:

```
void f(int x) {
   int[1000] buffer;
   int[] my_array = x < buffer.length ? buffer[0 .. x] : new 
int[](x);

}
```

Which gives the speed benefits of static without putting a size 
limit on it.


Just make sure you keep track of ownership with any of these 
strategies.


Also what is it possible in D to write a function that accepts 
an static array of any size?


Best option is to just accept a slice:

void f(int[] x);


and call it like so:

int[123] some_static_array;
f(some_static_array[]);


That will work on any size and typically give best performance. 
Again though, just use caution about ownership when using static 
arrays.


[Issue 15771] FileLogger should create the output directory if it does not exist

2017-07-12 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=15771

--- Comment #2 from github-bugzi...@puremagic.com ---
Commits pushed to master at https://github.com/dlang/phobos

https://github.com/dlang/phobos/commit/e85381ee42652029a8b1c8d8397aee78c2ae7139
Fix Issue 15771 - FileLogger should create the output directory if it does not
exist

https://github.com/dlang/phobos/commit/d27a3bf9d53c9b0dd35f70c5060891d68dd6ce6a
Merge pull request #5594 from RazvanN7/Issue_15771

Fix Issue 15771 - FileLogger should create the output directory if it does not
exist
merged-on-behalf-of: Sebastian Wilzbach 

--


[Issue 15771] FileLogger should create the output directory if it does not exist

2017-07-12 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=15771

github-bugzi...@puremagic.com changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |FIXED

--


Re: proposed @noreturn attribute

2017-07-12 Thread Meta via Digitalmars-d

On Wednesday, 12 July 2017 at 09:32:32 UTC, Timon Gehr wrote:

On 09.07.2017 23:45, Meta wrote:

...
Another case that we should probably just statically disallow:
... > This obviously doesn't make any sense anyway
... > I don't see a reason for us to ever need to do that
Sorry, but this thinking has no place in type system design. 
This is precisely how you create a convoluted nonsensical mess.


D is not ML or Haskell or Idris. Rust has trod this ground before 
us and they saw it prudent to not make ! a first-class type. I 
think this is both a concession to usability and an acceptable 
compromise for a systems programming language.


[Issue 17638] A pragma inside a function body is seen as a statement

2017-07-12 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17638

--- Comment #1 from anonymous4  ---
This can't be a declaration, because empty declaration can't have attributes:
---
static;
---
Error: declaration expected following attribute, not ';'

--


Re: D Milestones

2017-07-12 Thread jmh530 via Digitalmars-d
On Wednesday, 12 July 2017 at 12:40:21 UTC, Martin Tschierschke 
wrote:

On Monday, 26 June 2017 at 18:16:12 UTC, Patrick Schluter wrote:

On Monday, 26 June 2017 at 12:58:00 UTC, Andrea Fontana wrote:

On Monday, 26 June 2017 at 10:14:08 UTC, Martin Tschierschke

[...]
So the first version 0.0.1 of this in the Wiki, please help to 
update!


https://wiki.dlang.org/Language_History_and_Future


I would recommend going through the changelogs and picking out 
some key developments. At a minimum, it provides information like 
D 2.0 was released June 17, 2007 (D 1.001 Jan. 23, 2007). I don't 
see much on the prior history.


http://dlang.org/changelog/
http://www.digitalmars.com/d/1.0/changelog.html


Re: D Milestones

2017-07-12 Thread Nemanja Boric via Digitalmars-d

On Wednesday, 12 July 2017 at 13:11:47 UTC, Nicholas Wilson wrote:
On Wednesday, 12 July 2017 at 12:40:21 UTC, Martin Tschierschke 
wrote:
On Monday, 26 June 2017 at 18:16:12 UTC, Patrick Schluter 
wrote:

On Monday, 26 June 2017 at 12:58:00 UTC, Andrea Fontana wrote:

On Monday, 26 June 2017 at 10:14:08 UTC, Martin Tschierschke

[...]
So the first version 0.0.1 of this in the Wiki, please help to 
update!


https://wiki.dlang.org/Language_History_and_Future


If you're looking for more info Leandro's Keynote (DConf 2016?) 
has lots of history.


Yup, 2016: http://dconf.org/2016/talks/lucarella.html


Re: D Milestones

2017-07-12 Thread Nicholas Wilson via Digitalmars-d
On Wednesday, 12 July 2017 at 12:40:21 UTC, Martin Tschierschke 
wrote:

On Monday, 26 June 2017 at 18:16:12 UTC, Patrick Schluter wrote:

On Monday, 26 June 2017 at 12:58:00 UTC, Andrea Fontana wrote:

On Monday, 26 June 2017 at 10:14:08 UTC, Martin Tschierschke

[...]
So the first version 0.0.1 of this in the Wiki, please help to 
update!


https://wiki.dlang.org/Language_History_and_Future


If you're looking for more info Leandro's Keynote (DConf 2016?) 
has lots of history.


[Issue 17395] std.file.rmdirRecurse isn't @safe

2017-07-12 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17395

Seb  changed:

   What|Removed |Added

   Keywords||bootcamp

--


Re: Function with static array as parameter

2017-07-12 Thread Rene Zwanenburg via Digitalmars-d-learn

On Wednesday, 12 July 2017 at 12:57:19 UTC, Rene Zwanenburg wrote:

On Wednesday, 12 July 2017 at 12:20:11 UTC, Miguel L wrote:
What is the best way in D to create a function that receives a 
static array of any length?


Templatize the array length:

void foo(size_t length)(int[length] arr)
{

}


That being said, this may lead to template bloat and excessive 
copying. What are you trying to do? Is there a reason you can't 
use a slice?


Re: Function with static array as parameter

2017-07-12 Thread Biotronic via Digitalmars-d-learn

On Wednesday, 12 July 2017 at 12:20:11 UTC, Miguel L wrote:
What is the best way in D to create a function that receives a 
static array of any length?


You will need to use templates:

void foo(size_t N)(int[N] arr) {
}

--
  Biotronic


Re: Function with static array as parameter

2017-07-12 Thread Rene Zwanenburg via Digitalmars-d-learn

On Wednesday, 12 July 2017 at 12:20:11 UTC, Miguel L wrote:
What is the best way in D to create a function that receives a 
static array of any length?


Templatize the array length:

void foo(size_t length)(int[length] arr)
{

}


Re: D Milestones

2017-07-12 Thread Martin Tschierschke via Digitalmars-d

On Monday, 26 June 2017 at 18:16:12 UTC, Patrick Schluter wrote:

On Monday, 26 June 2017 at 12:58:00 UTC, Andrea Fontana wrote:

On Monday, 26 June 2017 at 10:14:08 UTC, Martin Tschierschke

[...]
So the first version 0.0.1 of this in the Wiki, please help to 
update!


https://wiki.dlang.org/Language_History_and_Future



Re: DWT is official ?

2017-07-12 Thread Flaze07 via Digitalmars-d-dwt

On Wednesday, 12 July 2017 at 11:18:21 UTC, Jacob Carlborg wrote:

On 2017-07-12 12:10, Flaze07 wrote:
hi...so is this group forum about the SWT D bindings ? (I am 
just surprised that it is...in the ecosystem if it is what I 
think it is)


Technically DWT [1] is a port of SWT to D, not bindings. No 
Java code is involved.


[1] http://github.com/d-widget-toolkit/dwt


I see...
so...is it official ??


Re: DIP 1010--Static foreach--Formal Review

2017-07-12 Thread Adrian Matoga via Digitalmars-d
On Wednesday, 12 July 2017 at 10:57:37 UTC, Steven Schveighoffer 
wrote:
Perhaps the deprecation path should include a removal of 
straight foreach over a tuple working (use static foreach 
explicitly). This would make the distinction even more obvious.


I'd also vote for gradual removal of foreach over a tuple. It 
would be one less awkward moment when teaching D.





Function with static array as parameter

2017-07-12 Thread Miguel L via Digitalmars-d-learn
What is the best way in D to create a function that receives a 
static array of any length?


Re: Foreign threads in D code.

2017-07-12 Thread Biotronic via Digitalmars-d-learn

On Wednesday, 12 July 2017 at 12:08:35 UTC, Jacob Carlborg wrote:

On 2017-07-12 11:28, Biotronic wrote:


That's basically what I tried to say


It wasn't very clear to me at least.


Yeah, I see it in retrospect. "might collect memory that the 
thread is referencing on the stack or in non-GC memory" doesn't 
convey that the collected memory is only that which is allocated 
by the GC.


--
  Biotronic


Re: Hiring D programmers (with cryptography and blockchain knowledge are preferred)

2017-07-12 Thread Kagamin via Digitalmars-d-announce
On Wednesday, 12 July 2017 at 11:11:20 UTC, Steven Schveighoffer 
wrote:
Have you heard of https://gab.ai ? They are doing something 
similar (in terms of providing an uncensored platform).


Another one is dreamwidth.org, it started as a reaction to 
tighter control too and has a permissive content policy.


Re: version=D_16

2017-07-12 Thread Adrian Matoga via Digitalmars-d

On Monday, 10 July 2017 at 21:30:44 UTC, Walter Bright wrote:

On 7/10/2017 1:52 PM, Luís Marques wrote:

On Monday, 10 July 2017 at 20:19:46 UTC, Walter Bright wrote:

On 7/10/2017 12:46 PM, Luís Marques wrote:
I'm curious how that implementation addresses the issues I 
brought up:


I'm not really sure how to respond, you mostly just made 
statements about your worldview. For instance:


"C++ on a 64K machine is like using a tank to get to the 
grocery store". If you mean using all of C++ features, sure, 
that's inappropriate. If you mean that there are no C++ 
features that you could use in a microcontroller, there are 
non-trivial amounts of people the disagree with you.


You can't use RTTI or Exceptions, for example. Those generate 
bloat even if they are not used - a compiler switch is typical 
to disable them. It's not true that C++ is "pay only for what 
you use".


If the C++ usage is "C with member functions", then yes, it'll 
work and be useful.


There's more to that. Since these chips have limited 
computational capabilities, you really want to move as much 
computation as possible into compile time. And this is what makes 
C++ a better choice than C, and D a better choice than C++. It's 
also the safer and more expressive type system that saves you the 
time you would spent on debugging every kind of bug resulting 
from casting everything to void* and back.





Re: Foreign threads in D code.

2017-07-12 Thread Jacob Carlborg via Digitalmars-d-learn

On 2017-07-12 11:28, Biotronic wrote:

That's basically what I tried to say 


It wasn't very clear to me at least.

- the GC may collect memory *it has 
allocated* if the only pointers to it are in memory the GC doesn't scan 
(i.e. on the stack of an unregistered thread or in memory not allocated 
via the GC).


It will not collect memory allocated by other means, but that Foo* you 
got from D and are using in C++ might point to a Bar soon after the GC 
runs.


Yes, that can happen.

--
/Jacob Carlborg


Re: Struct Constructor Lazy

2017-07-12 Thread Biotronic via Digitalmars-d-learn

On Wednesday, 12 July 2017 at 12:02:37 UTC, Jiyan wrote:

Thank you, one last question:
If i declare the parameter as ref i, then there shouldnt be any 
overhead wouldnt it?


Thanks :)


That would be basically the exact equivalent - instead of passing 
an int, you'll be passing a pointer.


--
  Biotronic


Re: 2D game physics, macOS

2017-07-12 Thread Jacob Carlborg via Digitalmars-d-learn

On 2017-07-12 12:18, Joel wrote:

Is there a 2D physics library I can use on macOS, with D?

I already use a multimedia library for graphics, sound and input.


Box2D [1] perhaps. I think I've seen bindings for it, somewhere.

[1] http://box2d.org

--
/Jacob Carlborg


Help me fix my compiler

2017-07-12 Thread Namal via Digitalmars-d-learn

Hello,

I used the Install Script command line to install the newest dmd 
compiler (Ubuntu 16.04.2 LTS). Now I have to type 'source 
~/dlang/dmd-2.074.1/activate' before I can use it and it is also 
not show in the software center like it used to be. How can I fix 
it or how can I remove it?


Thx


Re: Struct Constructor Lazy

2017-07-12 Thread Jiyan via Digitalmars-d-learn

Thank you, one last question:
If i declare the parameter as ref i, then there shouldnt be any 
overhead wouldnt it?


Thanks :)



Re: Struct Constructor Lazy

2017-07-12 Thread Biotronic via Digitalmars-d-learn

On Wednesday, 12 July 2017 at 11:34:45 UTC, Jiyan wrote:

Hey,
yes i did but to be honest i used dmd in debug version.
The thing about the static one, is that it creates a local 
object A isnt that a performance issue itself - or am i wrong - 
im confused actually :P?


Debug = no optimization. Looking at the generated assembly in a 
debug build is worthless.


You raise a valid point. In a debug build, you're probably right 
- it will need to copy the temporary to the target. With 
optimizations enabled, NRVO[0] will populate the target directly, 
resulting in roughly the equivalent of this code:


struct A {
int field;
static void opCall(A* p) {
p.field = getDataFromFile("file.txt");
}
}

A a;
A();

If the function is inlined, the whole problem is of course moot. 
There are probably other optimizations that can interfere with 
what I've described.


--
  Biotronic

[0]: https://en.wikipedia.org/wiki/Return_value_optimization


[Issue 4541] Intrinsic functions do not have pointers

2017-07-12 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=4541

RazvanN  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 CC||razvan.nitu1...@gmail.com
 Resolution|--- |FIXED

--- Comment #8 from RazvanN  ---
I think that this issue is no longer valid since using the std.math wrappers
results in successful compilation. Even though using core.math results in link
failure, I do not think this is a problem since that is the runtime library and
who uses it should know that the functions declared there are intrinsics.
Anyway, this is not a phobos bug anymore and I don't think it is a druntime one
either. Closing
as fixed.

--


Re: Struct Constructor Lazy

2017-07-12 Thread Jiyan via Digitalmars-d-learn

On Wednesday, 12 July 2017 at 11:18:08 UTC, Biotronic wrote:

On Wednesday, 12 July 2017 at 11:00:54 UTC, Jiyan wrote:

[...]


The traditional solution is static opCall:

struct A {
int field;
static A opCall() {
A result;
result.field = getDataFromFile("file.txt");
return result;
}
}

A instance = A();

I believe I've heard this is frowned upon these days, but I 
don't know of a better solution.


For optimal speed you might also want to skip default 
initialization of result, by writing A result = void;.


I would be surprised if the optimizer wasn't able to optimize 
away the useless parameter though - have you looked at the 
generated assembly?


--
  Biotronic


Hey,
yes i did but to be honest i used dmd in debug version.
The thing about the static one, is that it creates a local object 
A isnt that a performance issue itself - or am i wrong - im 
confused actually :P?


[Issue 4535] std.range could have a takeWhile!pred(range) function

2017-07-12 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=4535

--- Comment #10 from RazvanN  ---
PR : https://github.com/dlang/phobos/pull/5563

We should either close this or work on the PR.

--


Re: DWT is official ?

2017-07-12 Thread Jacob Carlborg via Digitalmars-d-dwt

On 2017-07-12 12:10, Flaze07 wrote:
hi...so is this group forum about the SWT D bindings ? (I am just 
surprised that it is...in the ecosystem if it is what I think it is)


Technically DWT [1] is a port of SWT to D, not bindings. No Java code is 
involved.


[1] http://github.com/d-widget-toolkit/dwt

--
/Jacob Carlborg


Re: Struct Constructor Lazy

2017-07-12 Thread Biotronic via Digitalmars-d-learn

On Wednesday, 12 July 2017 at 11:00:54 UTC, Jiyan wrote:

Hey there:)

i want to know whether the following is somehow possible:
structs dont have default constructors, i know so:

struct A
{
int field;
this(int i){field = getDataFromFile("file.txt");}
}

A instance = A(0);

Here comes my issue:
when A(0) is called I would want here optimal performance, so 
there doesnt even need to be a value pushed on the stack (i=0), 
what would be like having a constructor with zero arguments (i 
is never used!).

Im pretty new to D, can somebody tell me how i would do this?
Is this(lazy int i){ ... a solution?


The traditional solution is static opCall:

struct A {
int field;
static A opCall() {
A result;
result.field = getDataFromFile("file.txt");
return result;
}
}

A instance = A();

I believe I've heard this is frowned upon these days, but I don't 
know of a better solution.


For optimal speed you might also want to skip default 
initialization of result, by writing A result = void;.


I would be surprised if the optimizer wasn't able to optimize 
away the useless parameter though - have you looked at the 
generated assembly?


--
  Biotronic


Re: Hiring D programmers (with cryptography and blockchain knowledge are preferred)

2017-07-12 Thread Steven Schveighoffer via Digitalmars-d-announce

On 7/12/17 12:40 AM, Vitor Rozsas wrote:
* First of all, does Dlang.org have it's own website for hiring D 
programmers or offering D programming services? If not, it should!


Hello!
I need a project, and I want it done with D (please note that it will be 
open-sourced, but I'll pay for the first functioning version).
It is supposed to be useful for users of the project AND for learners of 
D (so lots of comments in the source code are actually encouraged!).


It's a social media. More specifically, an incensurable social media; 
all it's posts will be stored in a blockchain, and this will be copied 
and distributed through the world. I had the idea after seeing that many 
political posts were being removed from Facebook and Twitter. They are 
controlling people's opinions and I don't like it. People should be free 
to say whatever they want, this is freedom of speech.


Have you heard of https://gab.ai ? They are doing something similar (in 
terms of providing an uncensored platform).


-Steve


  1   2   >