Re: [OT] mobile rising

2017-11-12 Thread codephantom via Digitalmars-d

On Sunday, 12 November 2017 at 22:39:36 UTC, Walter Bright wrote:

On 11/10/2017 2:54 PM, codephantom wrote:

 MSFT fanboy...at it again...


Knock it off, everyone.


Oh gee..Sorry daddy.

...maybe you have jumped in a few 100 threads ago, and addressed 
your response to the actual perpertrator that began this..ie. 
when Jerry the MSFT fanboy decided to start have a go at me - 
personally - for suggesting I should be able to build a 64bit 
binary with D, without spending a whole day downloading GB's of 
proprietory bloatware.


Or maybe, when Jonathan M Davies started bashing on me - 
personally - for linking to a humourous video about windows 10, 
as a way to suggest we proceed with caution when taking advice 
from MSFT.


It's so like people these days, and even on these forums, to 
attack the ones sticking up for themselves, rather than stopping 
them from being attacked in the first place, just for having a 
different opinion - or god forbid...making a joke about MSFT.






[Issue 16398] experimental allocators, add aligned reallocation for Posix

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

Basile B.  changed:

   What|Removed |Added

   Keywords||pull

--- Comment #2 from Basile B.  ---
PR https://github.com/dlang/phobos/pull/5857

--


[Issue 12064] std.typecons.wrap doesn't handle NVI

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

Basile B.  changed:

   What|Removed |Added

   Keywords||pull
 CC||b2.t...@gmx.com

--- Comment #1 from Basile B.  ---
PR https://github.com/dlang/phobos/pull/5858

--


Re: How do I use Socket.select?

2017-11-12 Thread Mike Parker via Digitalmars-d-learn

On Sunday, 12 November 2017 at 21:45:56 UTC, Anonymouse wrote:



But a "status change" for a reading Socket is "stuff can now 
connect", for a writing one "connection established", and not 
sure about the error ones. It doesn't seem to be "there's data 
waiting to be read" which I'd hoped for, since my program (IRC 
bot) in essence connects once and stays such throughout its 
life.


What else is there to select that I'm missing? Or is it mostly 
a thing for programs with lots of Sockets, lots of connections?


The read set is used to determine if a socket has data waiting to 
read. It just happens that with a listening socket, that means 
there's a new connection. With a normal socket, it means data 
packets are ready. Maybe you should take a look at the classic 
Beej's guide, which covers the C API. Should be easy to translate 
to the std.socket API.


http://beej.us/guide/bgnet/


core file

2017-11-12 Thread Tony via Digitalmars-d-learn

I am getting the message from my program execution:

"Segmentation fault (core dumped)"

But I don't see a core file in the current directory or in my 
home directory. Is there one somewhere? Would I be able to do 
anything meaningful with it if it exists?


Re: New QtE5 version and the test it - mini ide ide5

2017-11-12 Thread lobo via Digitalmars-d-announce

On Sunday, 12 November 2017 at 08:04:37 UTC, MGW wrote:
QtE5 - gained further development. The new mechanism of 
operation with memory
is realized that allowed will get rid of crash of applications 
in case of completion.


The summary code amount increases all the time. New classes 
from Qt are added.

Now the code amount reached:
qte5.d  - 6700 lines
qte5widgets.cpp - 3500 lines

The considerable efforts are made in development of bitmap 
graphics,
QBitmap, QResource, QPixmap are added and properties for QImage 
are added.

The operation technique with QPainter is fulfilled.

https://www.youtube.com/watch?v=iWnWMKsNt0E
https://github.com/MGWL/QtE5


Thanks for this, and the installation was pretty easy to figure 
out, at least on Linux. I have not tried this with Windows.


Cheers,
A not so disappointed person


Re: [OT] mobile rising

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

On 11/8/2017 1:36 PM, Joakim wrote:

You don't want to own up to the fact that

Please refrain from berating others here.


Re: [OT] mobile rising

2017-11-12 Thread Jerry via Digitalmars-d

On Sunday, 12 November 2017 at 00:24:31 UTC, codephantom wrote:

On Saturday, 11 November 2017 at 20:35:40 UTC, Jerry wrote:


Taking away the start button wasn't that big of a deal.


Thanks...another qoute to add to:

'The famous quotes of Jerry the MSFT fanboy'.


It's easy to take a single sentence out of context maybe i should 
just keep everything as one long protruding sentence so that you 
are forced to quote everything so that you you won't misinterpret 
what it means by what I don't know maybe you just read the one 
sentence then decided you didn't feel like reading the rest cause 
you thought you saw what you wanted and then proceeded to post 
immediately without thinking as you for some reason needed to 
make four separate posts anyways have fun reading this sentence 
without proper punctuation maybe you'll come to appreciate it and 
actually quote the entire meaningful part of a text.


Re: Project Elvis

2017-11-12 Thread codephantom via Digitalmars-d

On Sunday, 12 November 2017 at 16:47:02 UTC, bauss wrote:


I told you once and I'll tell you twice.

I'm definitely not a MSFT fan boy.

The only thing I have in my development environment that's 
related to MS is their linker from Visual Studio, but I don't 
have anything else installed from VS.


All projects I have that I currently work on are written in D 
or C.


ok..I'll take you off the list too..for now.

I think maybe I need to get a cute gravatar, like you and Satoshi.

Maybe a little kitten or something.

Then maybe people will be less eager to attack me



Re: [OT] mobile rising

2017-11-12 Thread codephantom via Digitalmars-d

On Monday, 13 November 2017 at 00:47:46 UTC, codephantom wrote:

On Monday, 13 November 2017 at 00:41:32 UTC, Jerry wrote:

harassing people isn't defending your argument.


Yeah...it's not nice...being harassed..is it.

You have to be harassed to know what if feels like.

That was my objective. Not to harass you, but to let you know 
how I felt when you harassed me.


A more 'scientific' way of saying that, is that I was attempting 
to turn the observer into the actor.


https://www.ncbi.nlm.nih.gov/pubmed/1185516



Re: opCast'ing strings

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

On Monday, 13 November 2017 at 01:03:17 UTC, helxi wrote:
In this program, casting using to does not work as intended 
(returning 23/11) on the struct. However, calling opCast 
directly seems to do the job. Why is that?



to!string calls a function called `string toString() {}` on the 
struct, not the cast operator.


Re: [OT] mobile rising

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

On 11/10/2017 3:28 AM, Joakim wrote:

Your logic is extremely confused.

[...]

You seem to be confused


Please stop berating others here.


Re: core file

2017-11-12 Thread Tony via Digitalmars-d-learn

On Monday, 13 November 2017 at 05:37:12 UTC, codephantom wrote:

On Monday, 13 November 2017 at 05:01:18 UTC, Tony wrote:

I am getting the message from my program execution:

"Segmentation fault (core dumped)"

But I don't see a core file in the current directory or in my 
home directory. Is there one somewhere? Would I be able to do 
anything meaningful with it if it exists?


More info than that is needed.

What platform are you on?

Do you have core dumps enabled/disabled?

If you have it enabled...where does it put them?

And yes, core dumps are potentially useful for debugging.

However, given you're asking that question, and getting core 
dumps, then it might be easier for you to use the -g option 
when you compile, and then run your executable (or a.out) 
through a debugger:


https://www.youtube.com/watch?v=vcVmWbYEIsk


I am on Ubuntu 16.04. Thanks, I didn't know that "producing a 
core file" was configurable, and it appears that it isn't.


Re: [OT] mobile rising

2017-11-12 Thread Jerry via Digitalmars-d

On Monday, 13 November 2017 at 00:22:46 UTC, codephantom wrote:
It's so like people these days, and even on these forums, to 
attack the ones sticking up for themselves, rather than 
stopping them from being attacked in the first place, just for 
having a different opinion - or god forbid...making a joke 
about MSFT.


You weren't attacked and you aren't a victim stop trying to paint 
yourself one you stated an opinion and a counter argument was 
made nothing more or less no one called you names or fanboy or 
whatever and if you wanted it to stop you could have just stopped 
posting instead of posting your own harassment you aren't 
defending yourself if you are constantly calling other people 
"msft fanboys" harassing people isn't defending your argument.


Re: [OT] mobile rising

2017-11-12 Thread Jerry via Digitalmars-d

On Monday, 13 November 2017 at 00:40:29 UTC, codephantom wrote:

On Monday, 13 November 2017 at 00:36:17 UTC, Jerry wrote:
It's easy to take a single sentence out of context maybe i 
should just keep everything as one long protruding sentence so 
that you are forced to quote everything so that you you won't 
misinterpret what it means by what I don't know maybe you just 
read the one sentence then decided you didn't feel like 
reading the rest cause you thought you saw what you wanted and 
then proceeded to post immediately without thinking as you for 
some reason needed to make four separate posts anyways have 
fun reading this sentence without proper punctuation maybe 
you'll come to appreciate it and actually quote the entire 
meaningful part of a text.


What?

I can even understand C# better than this.


:) Glad you got the point.


Re: [OT] mobile rising

2017-11-12 Thread codephantom via Digitalmars-d

On Monday, 13 November 2017 at 00:36:17 UTC, Jerry wrote:
It's easy to take a single sentence out of context maybe i 
should just keep everything as one long protruding sentence so 
that you are forced to quote everything so that you you won't 
misinterpret what it means by what I don't know maybe you just 
read the one sentence then decided you didn't feel like reading 
the rest cause you thought you saw what you wanted and then 
proceeded to post immediately without thinking as you for some 
reason needed to make four separate posts anyways have fun 
reading this sentence without proper punctuation maybe you'll 
come to appreciate it and actually quote the entire meaningful 
part of a text.


What?

I can even understand C# better than this.



Re: String import an entire directory

2017-11-12 Thread crimaniak via Digitalmars-d
On Saturday, 11 November 2017 at 14:11:50 UTC, Neia Neutuladh 
wrote:
I can make a prebuild script to generate code for this, but I'm 
wondering: do other people find themselves needing this 
periodically? If so, I can write a DIP for it, or at least 
publish a codegen tool that other people can use.
 Yes, sometimes it's good to have more extended imports and 
compile-time possibilities to avoid tweaking dub build process, 
but I think, for current time language has a lot of more actual 
issues so it's better to leave this task for external tools.




opCast'ing strings

2017-11-12 Thread helxi via Digitalmars-d-learn

struct Fraction
{
private:
int numerator = 1, denominator = 1;
public:
string opCast(T : string)() const
{
import std.conv : to;

return numerator.to!string() ~ "/" ~ denominator.to!string();
}
}

void main()
{
import std.stdio, std.conv;

Fraction n = Fraction(23, 11);
writeln(n.to!string(), " ", n.opCast!string);
}



In this program, casting using to does not work as intended 
(returning 23/11) on the struct. However, calling opCast directly 
seems to do the job. Why is that?


Re: The latest Terrarium TV 1.8.1 has been updated.

2017-11-12 Thread solidstate1991 via Digitalmars-d-announce
On Wednesday, 8 November 2017 at 09:40:01 UTC, Theresa Henson 
wrote:
The update is compatible with the latest Android OS as well as 
all others over Android 4.0


Was this (at least partly) developed using D? Or you just using 
the forum to promote this product?


Re: core file

2017-11-12 Thread Ali Çehreli via Digitalmars-d-learn

On 11/12/2017 10:25 PM, Tony wrote:

>>> "Segmentation fault (core dumped)"

I've been assuming that if it says "dumped", the core is dumped.

> I am on Ubuntu 16.04. Thanks, I didn't know that "producing a core file"
> was configurable, and it appears that it isn't.

It is. If you search for "where is core file ubuntu" you will hit the 
output of 'man core', as well as answers like the following, which 
explains that the file may be under /var/cache/abrt:



https://stackoverflow.com/questions/2065912/core-dumped-but-core-file-is-not-in-current-directory

Ali



[Issue 17976] core.exception.AssertError@ddmd/dsymbolsem.d(1624)

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

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

   What|Removed |Added

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

--


[Issue 17976] core.exception.AssertError@ddmd/dsymbolsem.d(1624)

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

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

https://github.com/dlang/dmd/commit/bfa0da8d413ed283868fcd103ee398e41a29deef
Fix Issue 17976 - core.exception.AssertError@ddmd/dsymbolsem.d

https://github.com/dlang/dmd/commit/03e806abaae49fe84de8fc0bdbe2ead80f58d038
Merge pull request #7297 from RazvanN7/Issue_17976

Fix Issue 17976 - core.exception.AssertError@ddmd/dsymbolsem.d(1624)

--


Re: Project Elvis

2017-11-12 Thread codephantom via Digitalmars-d

On Sunday, 12 November 2017 at 16:47:02 UTC, bauss wrote:


I told you once and I'll tell you twice.

I'm definitely not a MSFT fan boy.



Well, you were pretty quick to jump into the middle of a 
conversation, just to have a long..drawn outgo at me, because 
I had some critical comments to say about C#  - a language which 
I know all to well.


Only a MSFT fanboy would defend C# with that level of passion.

What else am I meant to assume?



Re: [OT] mobile rising

2017-11-12 Thread codephantom via Digitalmars-d

On Monday, 13 November 2017 at 00:41:32 UTC, Jerry wrote:

You weren't attacked and you aren't a victim ...


Another quote to add..thanks.

Keep em' coming... I could make money of this...


Re: [OT] mobile rising

2017-11-12 Thread codephantom via Digitalmars-d

On Monday, 13 November 2017 at 00:41:32 UTC, Jerry wrote:

harassing people isn't defending your argument.


Yeah...it's not nice...being harassed..is it.

You have to be harassed to know what if feels like.

That was my objective. Not to harass you, but to let you know how 
I felt when you harassed me.




Re: LDC 1.6.0-beta1

2017-11-12 Thread Brian via Digitalmars-d-announce

On Sunday, 12 November 2017 at 15:57:19 UTC, kinke wrote:

Hi everyone,

on behalf of the LDC team, I'm glad to announce the first beta 
for LDC 1.6. The highlights of this version in a nutshell:


* Based on D 2.076.1.
* Experimental support for dynamic codegen at runtime ('manual 
JIT').

* Many std.math functions are now CTFE-able.

Full release log and downloads: 
https://github.com/ldc-developers/ldc/releases/tag/v1.6.0-beta1


Thanks to all contributors!


Fast update, thank you!

There is no version for FreeBSD?



Re: How do I create a fileWatcher with an onFileChange event using spawn?

2017-11-12 Thread shuji via Digitalmars-d-learn

On Friday, 25 August 2017 at 21:25:37 UTC, Enjoys Math wrote:



Something like this:


module file_watcher;

import std.concurrency;
import std.file;
import std.signals;
import std.datetime;


void fileWatcher(Tid tid, string filename, int loopSleep) {
auto modified0 = timeLastModified(filename);

while (true) {
modified = timeLastModified(filename);

if (modified > modified0) {
modified0 = modified;
//if (onFileChange !is null)
//onFileChange(receiver);
}

sleep(dur!"msecs"(loopSleep));
}
}


But I'm not sure how to send the onFiledChange event.


@Nemanja Boric I would not recommend calling those APIs on 
Windows because they work on entire directories, not suitable for 
individual files and sometimes  those functions not even work 
when other programs change the files in a non standard way (that 
has happened to me before when editing through a text editor)
@Enjoys Math The way I usually deal with this problem is I save 
the filename, the time and handler function in an associative 
array and loop through when something changes, this way you can 
delete, sort, etc on the map when the files are deleted or so.

Hope this helps a little.


Re: core file

2017-11-12 Thread codephantom via Digitalmars-d-learn

On Monday, 13 November 2017 at 05:01:18 UTC, Tony wrote:

I am getting the message from my program execution:

"Segmentation fault (core dumped)"

But I don't see a core file in the current directory or in my 
home directory. Is there one somewhere? Would I be able to do 
anything meaningful with it if it exists?


More info than that is needed.

What platform are you on?

Do you have core dumps enabled/disabled?

If you have it enabled...where does it put them?

And yes, core dumps are potentially useful for debugging.

However, given you're asking that question, and getting core 
dumps, then it might be easier for you to use the -g option when 
you compile, and then run your executable (or a.out) through a 
debugger:


https://www.youtube.com/watch?v=vcVmWbYEIsk



Re: Deprecate implicit `int` to `bool` conversion for integer literals

2017-11-12 Thread Ola Fosheim Grøstad via Digitalmars-d
On Sunday, 12 November 2017 at 13:34:50 UTC, Dmitry Olshansky 
wrote:

if (a & (flag1 | flag2))

to

if ((a & (flag1 | flag2)) != 0)

When the first is quite obvious.


Just change the typing of the if-conditional to:

if (boolean|integral) {…}



Re: Deprecate implicit `int` to `bool` conversion for integer literals

2017-11-12 Thread Temtaime via Digitalmars-d
On Sunday, 12 November 2017 at 16:00:28 UTC, Ola Fosheim Grøstad 
wrote:
On Sunday, 12 November 2017 at 13:34:50 UTC, Dmitry Olshansky 
wrote:

if (a & (flag1 | flag2))

to

if ((a & (flag1 | flag2)) != 0)

When the first is quite obvious.


Just change the typing of the if-conditional to:

if (boolean|integral) {…}


There's no force change.
if explicitly converts cond to bool.


Re: [OT] mobile rising

2017-11-12 Thread Dave Jones via Digitalmars-d

On Sunday, 12 November 2017 at 02:07:03 UTC, codephantom wrote:

On Saturday, 11 November 2017 at 20:35:40 UTC, Jerry wrote:
When I joined the forum a little while back, I dared to 
suggest that D should be able to compile a 64bit binary on 
Windows, without having to relying on gigabytes of 
proprietaty, closed source, bloat from MSFT.


I stand by that comment, despite the harrassment from the 
many MSFT fanboys on these forums.


Acting as victim, you've done more harassing than anyone. How 
ironic you label people "MSFT fanboy" in the same sentence you 
cry harassment.


And again, I'd like to point out to everyone, that the attack 
on me, in this thread, started becasue I dared to suggest you 
should be able to compile a 64bit D executable, on Windows, 
without have to download GB's of propriatey, closed-source, 
bloatware.


Jesus Christ you big pair of fecking babys.

Nobody argued it wouldn't be better to have 64 bit out of the 
box. They argued you were making a big deal out of something that 
just works for most everyone else. And yes you hate Microsoft, 
and windows, and visual studio, and the chumps that use that 
crap. Jerry hates you for something, i think i missed why, but he 
clearly thinks you're a bit slow. Oh and you played the I use a 
plain text editor card, cause that's what real programmers do. 
Real programmers use a DOS text editor and store shit on tape... 
i mean punch cards, punch cards are best. The kids these days 
with their fancy I.. D.. E..s, they are not real programmers, 
just monkeys with typewriters.


I wish I was young again. I used to love arguing about pointless 
crap, i couldn't resit it, mac vs pc, risc vs cisc, sony vs 
nintendo, utd vs liverpool, and there are always so many 
opportunities to take offence when you're young now I'm old 
and don't give a shit its taken me 32 pages to build up enough 
energy to post two bleeding paragraphs. So ignore my first 
comment, enjoy while you're young, it's good to see a couple of 
young bucks trying to spill each others guts onto the newsgroup!








Re: [OT] mobile rising

2017-11-12 Thread Ola Fosheim Grøstad via Digitalmars-d

On Sunday, 12 November 2017 at 10:18:09 UTC, Tony wrote:
But those humans at the top, working for public companies, are 
monitored by a board and stockholders who place "making money" 
as the main, and normally only, measure of their job 
performance.


Sure, when you get a leader that is weak on vision then he or she 
might opting for milking the customer base to satisfy stock 
owners and over time erode support… So there most certainly can 
be radical changes when the original «gründer» or a strong 
«visonary» is displaced. I think it would have been very 
difficult to displace Steve Jobs though.


You could probably make the same argument about IKEA. As long as 
the original vision is strong (good value affordable-DIY 
furniture) then it will be difficult to displace, with weak 
leadership that could erode and profits would outweigh vision and 
they would erode their brand (what-we-are-all-about).


"growing and retaining market share" is a part of "all about 
making money", to me. My definition of "not all about making 
money" is when a company does things to benefit the environment 
or citizens or employees that they could have legally avoided, 
which gives them lower profits than they would have had from 
the other course of action.


It all depends. Are the stock markets fully rational? Probably 
not, many invest based on what they think other investors will 
like and not by analysing objective measures of profits.  Some 
companies are not even on the stock market (i.e. IKEA is a 
foundation). Will stock markets only reward companies that have 
good objective profits to show to or will they also reward 
companies that have low profit margins but are insanely big?


IBM were insanely big in terms of market dominance. Silicon 
Graphics and SUN were big in high-performance computing. Where 
did that go? There is a perception that being big will 
necessarily mean large profits in the future. That may be the 
case, but it could also mean that you've got a juggernaut that is 
difficult to steer…


However, I think it is very difficult for a company over time to 
retain a strong brand vision if they only care about short-term 
profits. With weak leaders that are not capable of projecting 
visions then the share owners will take control and perhaps send 
the company in the wrong direction… With good communication of 
strong visions it is harder to get a majority behind such changes.


I see Amazon as foregoing profits now for growth - and also 
wiping out the competition - in order to reap massive profits 
in the future.  At least, I haven't heard of them foregoing 
profits in order to benefit employees, citizens or the 
environment. Their stock price has a very high valuation (PE 
ration of 285.1), reflective of investors expecting massive 
profits in the future.


Right, but how rational is that analysis? I find better deals and 
better products on dedicated netshops. If Amazon controlled the 
search applications, then it would look more certain. But as long 
as there are free price-comparison applications… Who knows if 
being that generic will be an advantage.


E.g. is it conceivable that Amazon could beat IKEA? And will 
people in the future buy physical books, music or movies? What is 
the long term market place for Amazon?


(I like Amazon for convenience though.)

That is what I see as the Apple way of doing things from their 
beginning back in the late 1970s. They make premium and/or 
unique products and then mark them up more than anybody in the 
industry. Their products have always been unique with regard to 
the OS (except for a year or two when they allowed Mac clones) 
making the situation that no other manufacturer can offer an 
identical product.


Sure, but Steve Jobs understood that they should try to make 
their products available on the grass-root level also. So they 
made a line that was affordable enough for people to buy for 
school class rooms and teenagers. Those are future customers, so 
even if you don't make large profit margins it is a good 
investment. iOS is a bit generic and identity-less compared to 
say MacOS.


Current Apple management does not understand that and schools get 
good deals on Windows PCs instead…









Re: Deprecate implicit `int` to `bool` conversion for integer literals

2017-11-12 Thread Ola Fosheim Grøstad via Digitalmars-d

On Sunday, 12 November 2017 at 16:04:59 UTC, Temtaime wrote:

There's no force change.
if explicitly converts cond to bool.


Yes, but that is a flaw IMO. E.g. NaN will convert to true.



Re: Deprecate implicit `int` to `bool` conversion for integer literals

2017-11-12 Thread Michael V. Franklin via Digitalmars-d
On Sunday, 12 November 2017 at 13:34:50 UTC, Dmitry Olshansky 
wrote:



However, I’d hate to rewrite things like:

if (a & (flag1 | flag2))

to

if ((a & (flag1 | flag2)) != 0)

When the first is quite obvious.


I don't think the proposal to deprecate integer literal 
conversions to `bool` would affect that as there doesn't appear 
to be an integer literal in the code.


Mike


Automatic insertion of D-style multiline-comments in Emacs

2017-11-12 Thread Nordlöw via Digitalmars-d-learn
Have anybody added logic to Emacs' `comment-dwim` that 
automagically inserts a (Ddoc-style) multi-line comment like


/** ...
 */
void foo
{
}

if the cursor is currently in front of a (function) definition 
(or declaration)?


I realize that the challenge here is context detection; perhaps 
`beginning-of-defun()` could be used?


Re: Automatic insertion of D-style multiline-comments in Emacs

2017-11-12 Thread Nordlöw via Digitalmars-d-learn

On Sunday, 12 November 2017 at 12:52:48 UTC, Nordlöw wrote:
Have anybody added logic to Emacs' `comment-dwim` that 
automagically inserts a (Ddoc-style) multi-line comment like


Posted also here:

https://stackoverflow.com/questions/47249052/automatic-insertion-of-multiline-declaration-comments


Re: Automatic insertion of D-style multiline-comments in Emacs

2017-11-12 Thread Basile B. via Digitalmars-d-learn

On Sunday, 12 November 2017 at 12:52:48 UTC, Nordlöw wrote:
Have anybody added logic to Emacs' `comment-dwim` that 
automagically inserts a (Ddoc-style) multi-line comment like


/** ...
 */
void foo
{
}

if the cursor is currently in front of a (function) definition 
(or declaration)?


I realize that the challenge here is context detection; perhaps 
`beginning-of-defun()` could be used?


my IDE AST tool does this and even more (detection of parameters, 
return section and throw section):


https://github.com/BBasile/Coedit/blob/master/dastworx/src/ddoc_template.d
https://www.youtube.com/watch?v=VEVqSItCKfo=11=PLzk8A0LUvEOV-OMdz09jfOahwnKoA2na_

though you would need a bridge to interpret and use the output in 
Emacs.


Re: Deprecate implicit `int` to `bool` conversion for integer literals

2017-11-12 Thread Michael V. Franklin via Digitalmars-d
On Sunday, 12 November 2017 at 13:49:51 UTC, Michael V. Franklin 
wrote:


I don't think the proposal to deprecate integer literal 
conversions to `bool` would affect that as there doesn't appear 
to be an integer literal in the code.


Nevermind. I see what you mean now.

Mike




Re: Project Elvis

2017-11-12 Thread bauss via Digitalmars-d

On Sunday, 12 November 2017 at 04:40:21 UTC, codephantom wrote:

On Sunday, 12 November 2017 at 01:00:46 UTC, bauss wrote:

I'm tired so I will end my post here.


And I'm going to end all my posts here, cause I'm sick of 
arguing with MSFT fanboys, who want to restrain D's development 
by tying it into propriatery, closed source, bloatware.


Besides being more productive, it also seems like more fun, 
than responding to MSFT fanboys (although that's been fun too).




I told you once and I'll tell you twice.

I'm definitely not a MSFT fan boy.

If I were one, I wouldn't have written a whole framework to 
replace my ASP.NET projects with D.


I would probably have .NET languges installed too, which I don't.

The only thing I have in my development environment that's 
related to MS is their linker from Visual Studio, but I don't 
have anything else installed from VS.


For the simply fact, I don't write any .NET code privately. I 
have some projects I still maintain, but I can do that without VS.


All projects I have that I currently work on are written in D or 
C.


-

On Sunday, 12 November 2017 at 08:59:05 UTC, Satoshi wrote:

It's for you!

https://i.imgur.com/NNgrSyP.png


Laughed really hard.


[Issue 17979] Improve documentation for lazy parameters

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

Alexey Kulentsov  changed:

   What|Removed |Added

   Hardware|x86_64  |All
 OS|Linux   |All

--


[Issue 17979] New: Improve documentation for lazy parameters

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

  Issue ID: 17979
   Summary: Improve documentation for lazy parameters
   Product: D
   Version: D2
  Hardware: x86_64
OS: Linux
Status: NEW
  Severity: enhancement
  Priority: P1
 Component: dlang.org
  Assignee: nob...@puremagic.com
  Reporter: criman...@gmail.com

Lazy parameters in fact implemented using delegates and affect @nogc
possibility. I propose additions to documentation:

https://dlang.org/spec/function.html#parameters section

It needs to write that the delegate is used, and explicitly document what
exactly happens in the case of several occurrences of the used parameter -
whether the delegate is called each time, or only the first, and then the
returned value is used (affects non-pure lazy parameters).

https://dlang.org/spec/garbage.html#op_involving_gc

It will be useful to mention lazy parameters in this list too.

--


Re: Deprecate implicit `int` to `bool` conversion for integer literals

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

On 11/12/2017 08:54 AM, Michael V. Franklin wrote:

On Sunday, 12 November 2017 at 13:49:51 UTC, Michael V. Franklin wrote:

I don't think the proposal to deprecate integer literal conversions to 
`bool` would affect that as there doesn't appear to be an integer 
literal in the code.


Nevermind. I see what you mean now.

Mike


A DIP could be formulated to only address the problem at hand. BTW, 
here's a really fun example:


void fun(long) { assert(0); }
void fun(bool) {}

enum int a = 2;
enum int b = 1;

void main()
{
fun(a - b);
}

The overload being called depends on (a) whether a - b can be computed 
during compilation or not, and (b) the actual value of a - b. Clearly a 
big problem for modular code. This is the smoking gun motivating the DIP.



Andrei


Re: New QtE5 version and the test it - mini ide ide5

2017-11-12 Thread MGW via Digitalmars-d-announce

On Sunday, 12 November 2017 at 10:26:33 UTC, user1234 wrote:

Hello, i was a bored yesterday and between two movies tried to 
install it (it was before the announce) and i have to say that 
it's not clear at all and delete it.
The main reason is that i expected the top level dub JSON to 
produce a kind of static library required by all the 
examples...so in a nutshell you must provide better 
instructions before disappointing more people. Sorry.


installation of QtE5 on win32
https://www.youtube.com/watch?v=d6-8lxs9xJo


Re: [OT] mobile rising

2017-11-12 Thread Tony via Digitalmars-d
On Friday, 10 November 2017 at 14:28:10 UTC, Ola Fosheim Grøstad 
wrote:

On Friday, 10 November 2017 at 12:55:24 UTC, Tony wrote:
Very few companies are not "all about making money". That is 
why Americans were laid off by the millions and replaced by 
workers in countries with much cheaper labor rates. Bad for 
the workers, good for "making money". Apple isn't unique in 
making all it's products outside the USA.


I understand what you mean, but I don't think it is a 
scientific fact that companies are all about making money. They 
are run by humans with a set of beliefs and desires which they 
operate under…


But those humans at the top, working for public companies, are 
monitored by a board and stockholders who place "making money" as 
the main, and normally only, measure of their job performance.


Anyway, even companies that are all about making money need to 
think long term, meaning to take care of their long term 
reputation. Microsoft was not all about making money in the 
90s, but they were all about growing and retaining market share 
using bad business practices and that cost them their 
reputation among IT professionals.


"growing and retaining market share" is a part of "all about 
making money", to me. My definition of "not all about making 
money" is when a company does things to benefit the environment 
or citizens or employees that they could have legally avoided, 
which gives them lower profits than they would have had from the 
other course of action. There are donations for various causes 
made by some public companies, but I think those are normally an 
insignificant percentage of their profits.


Companies like Amazon are more about growth than making money… 
Some banks are more about being big than making money long 
term… Too big to fail and the government will save your ass. 
Etc.


I see Amazon as foregoing profits now for growth - and also 
wiping out the competition - in order to reap massive profits in 
the future.  At least, I haven't heard of them foregoing profits 
in order to benefit employees, citizens or the environment. Their 
stock price has a very high valuation (PE ration of 285.1), 
reflective of investors expecting massive profits in the future.




I don't know. I use a mac daily, but there is not a single 
product in their line today that is anywhere near good value 
compared by what you get by building your own Linux/Windows box 
or buy a quality non-Apple product from Samsung or Asus…


That is what I see as the Apple way of doing things from their 
beginning back in the late 1970s. They make premium and/or unique 
products and then mark them up more than anybody in the industry. 
Their products have always been unique with regard to the OS 
(except for a year or two when they allowed Mac clones) making 
the situation that no other manufacturer can offer an identical 
product.





Re: Project Elvis

2017-11-12 Thread Satoshi via Digitalmars-d

On Sunday, 12 November 2017 at 08:33:34 UTC, Satoshi wrote:


I'm going to start focusing my attention on rewriting (some) 
of FreeBSD userland, using D ..and see what happens. (btw. 
such programs can easily be migrated to Linux/OSX too...or the 
new 'System D' ..when it arrives ;-)

You should starts from Kernel.

And if you don't want to start form scratch, you can use my OS 
written in D :)

https://github.com/Rikarin/Trinix


I'm expecting your first pull request in couple of days :)


Re: Project Elvis

2017-11-12 Thread Satoshi via Digitalmars-d

It's for you!

https://i.imgur.com/NNgrSyP.png


Re: Project Elvis

2017-11-12 Thread codephantom via Digitalmars-d

On Sunday, 12 November 2017 at 08:59:05 UTC, Satoshi wrote:

It's for you!

https://i.imgur.com/NNgrSyP.png


If you're actually taking bets on that...then put me down for 
$10_000.00


on the MSFT fanbois that is ;-)


Nice stuff with Trinix. I'll cross you off my list of 
fanboys...for now.




Re: Inline assembly question

2017-11-12 Thread Eugene Wissner via Digitalmars-d-learn
On Sunday, 12 November 2017 at 11:01:39 UTC, Dibyendu Majumdar 
wrote:

Hi,

I have recently started work on building a VM for Lua (actually 
a derivative of Lua) in X86-64 assembly. I am using the dynasm 
tool that is part of LuaJIT. I was wondering whether I could 
also write this in D's inline assembly perhaps, but there is 
one aspect that I am not sure how to do.


The assembly code uses static allocation of registers, but 
because of the differences in how registers are used in Win64 
versus Unix X64 - different registers are assigned depending on 
the architecture. dynasm makes this easy to do using macros; 
e.g. below.


|.if X64WIN
|.define CARG1, rcx // x64/WIN64 C call arguments.
|.define CARG2, rdx
|.define CARG3, r8
|.define CARG4, r9
|.else
|.define CARG1, rdi // x64/POSIX C call arguments.
|.define CARG2, rsi
|.define CARG3, rdx
|.define CARG4, rcx
|.endif

With above in place, the code can use the mnemonics to refer to 
the registers rather than the registers themselves. This allows 
the assembly code to be coded once for both architectures.


How would one do this in D inline assembly?

Thanks and Regards
Dibyendu


Here is an example with mixins:

version (Windows)
{
enum Reg : string
{
CARG1 = "RCX",
CARG2 = "RDX",
}
}
else
{
enum Reg : string
{
CARG1 = "RDI",
CARG2 = "RSI",
}
}

template Instruction(string I, Reg target, Reg source)
{
enum string Instruction = "asm { mov " ~ target ~ ", " ~ 
source ~ "; }";

}

void func()
{
mixin(Instruction!("mov", Reg.CARG1, Reg.CARG2));
}


Re: Inline assembly question

2017-11-12 Thread Basile B. via Digitalmars-d-learn
On Sunday, 12 November 2017 at 11:01:39 UTC, Dibyendu Majumdar 
wrote:

Hi,
[...]
The assembly code uses static allocation of registers, but 
because of the differences in how registers are used in Win64 
versus Unix X64 - different registers are assigned depending on 
the architecture. dynasm makes this easy to do using macros; 
e.g. below.

[...]
With above in place, the code can use the mnemonics to refer to 
the registers rather than the registers themselves. This allows 
the assembly code to be coded once for both architectures.


I see...the problem is not the input parameters but functions 
calls **inside** iasm, right ?


Re: Inline assembly question

2017-11-12 Thread Basile B. via Digitalmars-d-learn
On Sunday, 12 November 2017 at 12:17:51 UTC, Dibyendu Majumdar 
wrote:
On Sunday, 12 November 2017 at 11:55:23 UTC, Eugene Wissner 
wrote:

[...]


Thank you - I probably could use something like this. It is 
uglier than the simpler approach in dynasm of course.


How about when I need to combine this with some struct/union 
access? In dynasm I can write:


  |  mov BASE, CI->u.l.base // BASE = 
ci->u.l.base (volatile)
  |  mov PC, CI->u.l.savedpc// PC = 
CI->u.l.savedpc


How can I mix the mixin above and combine with struct offsets?

Thanks and Regards
Dibyendu


https://dlang.org/spec/iasm.html#agregate_member_offsets

aggregate.member.offsetof[someregister]


Re: Project Elvis

2017-11-12 Thread Satoshi via Digitalmars-d

On Sunday, 12 November 2017 at 03:25:47 UTC, codephantom wrote:


But everyone wants a more modular, more refined, more modern, 
more secure operating system ...and a more secure systems 
programming language.


How rewriting Linux from scratch will enhance security of the OS? 
By introducing more bugs to the new code?




But very who's focused on that?

Go has some potential, but I don't like many of its design 
decisions.

fakin' D fanboy!



So D could take advantage of the fact the big corporates are 
focused elsewhere (and, also, that they're not very likely to 
turn their attention to redeveloping their os any time soon).
Because nobody spends billions of dollars on something what will 
not brings anything new.




It could take advantage of Go, having made some questionable 
design decisions.


It could take advantage of Rust, seemingly going nowhere (IMHO).

So if there was ever a time for 'System D', it's now.

Instead, everyones focused on making it compatible..with 
this..and that...which is great..that will certainly bring 
attention to D...but I suspect it won't do too much more than 
that.


D needs a grander vision.





Re: Reorganization and list of D libraries (300+)

2017-11-12 Thread Andre Pany via Digitalmars-d-announce
On Monday, 6 November 2017 at 16:12:14 UTC, Martin Tschierschke 
wrote:

On Saturday, 4 November 2017 at 00:16:35 UTC, Ali Çehreli wrote:

On 11/03/2017 05:12 PM, Fra Mecca wrote:


https://github.com/FraMecca/D_Libraries_Registry


This effort should be combined with the current work being 
done to http://code.dlang.org/


I hope Martin, Seb, and others that are involved will see this 
thread. (Yes, I'm pinging them. :) )


Ali


Even being the wrong Martin :-) I think the DUB registry really 
needs more and better filters, so that the gems inside can be 
found easily. (like: Number of Github stars, number of 
downloads, number of developers and in the future: money 
donated to this project ...).


There has been several attempts but I would like to encourage 
the D Foundation to put more focus on this. Better ecosystem 
around third party software means less work for improvement of 
standard lib.


Regards mt.


As far as I understand, the D Language Foundation itself can work 
on specific

projects by the help of scholarship recipients paid by donations.

For me I see 3 ways to get enhancement / issues solved:
- Work on my spare time on the issue
- Motivate others to work in their spare time on the issue :)
- Donate to the D Language Foundation

Dub / Dub repository are already great products but in my opinion 
there

is still a lot of work to do.

Kind regards
André







Platform to make any programming language interactive & explorative (http://jupyter.org)

2017-11-12 Thread Robert M. Münch via Digitalmars-d
Hi, that might be some interesting project to add D to, for interactive 
exploration.


http://jupyter.org

Project Jupyter exists to develop open-source software, open-standards, 
and services for interactive computing across dozens of programming 
languages.


--
Robert M. Münch
http://www.saphirion.com
smarter | better | faster



Re: Inline assembly question

2017-11-12 Thread Dibyendu Majumdar via Digitalmars-d-learn

On Sunday, 12 November 2017 at 12:00:00 UTC, Basile B. wrote:
On Sunday, 12 November 2017 at 11:01:39 UTC, Dibyendu Majumdar 
wrote:

[...]
The assembly code uses static allocation of registers, but 
because of the differences in how registers are used in Win64 
versus Unix X64 - different registers are assigned depending 
on the architecture. dynasm makes this easy to do using 
macros; e.g. below.

[...]
With above in place, the code can use the mnemonics to refer 
to the registers rather than the registers themselves. This 
allows the assembly code to be coded once for both 
architectures.


I see...the problem is not the input parameters but functions 
calls **inside** iasm, right ?


Not sure I understand the question. Once the defines are there I 
can write following:


  | // Call luaF_close
  | mov CARG1, L   // arg1 = L
  | mov CARG2, BASE// arg2 = base
  | call extern luaF_close // call luaF_close

As you can see above, CARG1, L, CARG2, BASE are all mnemonics 
that map to registers. However this is only defined in one place.


Regards
Dibyendu


Re: Platform to make any programming language interactive & explorative (http://jupyter.org)

2017-11-12 Thread qznc via Digitalmars-d
On Sunday, 12 November 2017 at 12:12:43 UTC, Robert M. Münch 
wrote:
Hi, that might be some interesting project to add D to, for 
interactive exploration.


http://jupyter.org

Project Jupyter exists to develop open-source software, 
open-standards, and services for interactive computing across 
dozens of programming languages.


Last change 2 years ago, so probably some update needed.
https://github.com/DlangScience/PydMagic


New QtE5 version and the test it - mini ide ide5

2017-11-12 Thread MGW via Digitalmars-d-announce
QtE5 - gained further development. The new mechanism of operation 
with memory
is realized that allowed will get rid of crash of applications in 
case of completion.


The summary code amount increases all the time. New classes from 
Qt are added.

Now the code amount reached:
qte5.d  - 6700 lines
qte5widgets.cpp - 3500 lines

The considerable efforts are made in development of bitmap 
graphics,
QBitmap, QResource, QPixmap are added and properties for QImage 
are added.

The operation technique with QPainter is fulfilled.

https://www.youtube.com/watch?v=iWnWMKsNt0E
https://github.com/MGWL/QtE5


Inline assembly question

2017-11-12 Thread Dibyendu Majumdar via Digitalmars-d-learn

Hi,

I have recently started work on building a VM for Lua (actually a 
derivative of Lua) in X86-64 assembly. I am using the dynasm tool 
that is part of LuaJIT. I was wondering whether I could also 
write this in D's inline assembly perhaps, but there is one 
aspect that I am not sure how to do.


The assembly code uses static allocation of registers, but 
because of the differences in how registers are used in Win64 
versus Unix X64 - different registers are assigned depending on 
the architecture. dynasm makes this easy to do using macros; e.g. 
below.


|.if X64WIN
|.define CARG1, rcx // x64/WIN64 C call arguments.
|.define CARG2, rdx
|.define CARG3, r8
|.define CARG4, r9
|.else
|.define CARG1, rdi // x64/POSIX C call arguments.
|.define CARG2, rsi
|.define CARG3, rdx
|.define CARG4, rcx
|.endif

With above in place, the code can use the mnemonics to refer to 
the registers rather than the registers themselves. This allows 
the assembly code to be coded once for both architectures.


How would one do this in D inline assembly?

Thanks and Regards
Dibyendu


Re: Project Elvis

2017-11-12 Thread Satoshi via Digitalmars-d

On Sunday, 12 November 2017 at 04:40:21 UTC, codephantom wrote:

On Sunday, 12 November 2017 at 01:00:46 UTC, bauss wrote:

I'm tired so I will end my post here.


And I'm going to end all my posts here, cause I'm sick of 
arguing with MSFT fanboys, who want to restrain D's development 
by tying it into propriatery, closed source, bloatware.
Yeah, I'm MSFT fanboy because I think ?? and ?. operators from C# 
are useful.

Think of a number between 1 and 10 Yes, that's your IQ.



I'm going to start focusing my attention on rewriting (some) of 
FreeBSD userland, using D ..and see what happens. (btw. such 
programs can easily be migrated to Linux/OSX too...or the new 
'System D' ..when it arrives ;-)

You should starts from Kernel.

And if you don't want to start form scratch, you can use my OS 
written in D :)

https://github.com/Rikarin/Trinix

Besides being more productive, it also seems like more fun, 
than responding to MSFT fanboys (although that's been fun too).

How is rewriting the same software from C to D productive?



Sorry MSFT fanboys, if you don't know what userland means. Go 
google it.

Yeah, nobody is as smart as you.

Good luck with rewriting the same code. It's boring, bug 
introducing and useless work but do what you want.


Re: Inline assembly question

2017-11-12 Thread Nicholas Wilson via Digitalmars-d-learn
On Sunday, 12 November 2017 at 11:01:39 UTC, Dibyendu Majumdar 
wrote:

Hi,

I have recently started work on building a VM for Lua (actually 
a derivative of Lua) in X86-64 assembly. I am using the dynasm 
tool that is part of LuaJIT. I was wondering whether I could 
also write this in D's inline assembly perhaps, but there is 
one aspect that I am not sure how to do.


The assembly code uses static allocation of registers, but 
because of the differences in how registers are used in Win64 
versus Unix X64 - different registers are assigned depending on 
the architecture. dynasm makes this easy to do using macros; 
e.g. below.


|.if X64WIN
|.define CARG1, rcx // x64/WIN64 C call arguments.
|.define CARG2, rdx
|.define CARG3, r8
|.define CARG4, r9
|.else
|.define CARG1, rdi // x64/POSIX C call arguments.
|.define CARG2, rsi
|.define CARG3, rdx
|.define CARG4, rcx
|.endif

With above in place, the code can use the mnemonics to refer to 
the registers rather than the registers themselves. This allows 
the assembly code to be coded once for both architectures.


How would one do this in D inline assembly?

Thanks and Regards
Dibyendu


You could do it with a mixin, it would be rather ugly though. Not 
sure of another way off the top of my head.




Re: Inline assembly question

2017-11-12 Thread Dibyendu Majumdar via Digitalmars-d-learn

On Sunday, 12 November 2017 at 11:55:23 UTC, Eugene Wissner wrote:
On Sunday, 12 November 2017 at 11:01:39 UTC, Dibyendu Majumdar 
wrote:
I have recently started work on building a VM for Lua 
(actually a derivative of Lua) in X86-64 assembly. I am using 
the dynasm tool that is part of LuaJIT. I was wondering 
whether I could also write this in D's inline assembly 
perhaps, but there is one aspect that I am not sure how to do.


The assembly code uses static allocation of registers, but 
because of the differences in how registers are used in Win64 
versus Unix X64 - different registers are assigned depending 
on the architecture. dynasm makes this easy to do using 
macros; e.g. below.


|.if X64WIN
|.define CARG1, rcx // x64/WIN64 C call arguments.
|.define CARG2, rdx
|.define CARG3, r8
|.define CARG4, r9
|.else
|.define CARG1, rdi // x64/POSIX C call arguments.
|.define CARG2, rsi
|.define CARG3, rdx
|.define CARG4, rcx
|.endif

With above in place, the code can use the mnemonics to refer 
to the registers rather than the registers themselves. This 
allows the assembly code to be coded once for both 
architectures.


How would one do this in D inline assembly?

Thanks and Regards
Dibyendu


Here is an example with mixins:

version (Windows)
{
enum Reg : string
{
CARG1 = "RCX",
CARG2 = "RDX",
}
}
else
{
enum Reg : string
{
CARG1 = "RDI",
CARG2 = "RSI",
}
}

template Instruction(string I, Reg target, Reg source)
{
enum string Instruction = "asm { mov " ~ target ~ ", " ~ 
source ~ "; }";

}

void func()
{
mixin(Instruction!("mov", Reg.CARG1, Reg.CARG2));
}


Thank you - I probably could use something like this. It is 
uglier than the simpler approach in dynasm of course.


How about when I need to combine this with some struct/union 
access? In dynasm I can write:


  |  mov BASE, CI->u.l.base // BASE = 
ci->u.l.base (volatile)
  |  mov PC, CI->u.l.savedpc// PC = 
CI->u.l.savedpc


How can I mix the mixin above and combine with struct offsets?

Thanks and Regards
Dibyendu


Re: Deprecate implicit `int` to `bool` conversion for integer literals

2017-11-12 Thread Dmitry Olshansky via Digitalmars-d
On Saturday, 11 November 2017 at 14:54:42 UTC, Jonathan M Davis 
wrote:
On Saturday, November 11, 2017 13:40:23 Michael V. Franklin via 
Digitalmars- d wrote:
What's the official word on this: 
https://github.com/dlang/dmd/pull/6404


Does it need a DIP?

If I revive it will it go anywhere?

What needs to be done to move it forward?


It probably needs a DIP, since it's a language change, and 
based on what Walter has said in the past about this topic, I 
don't know how convincible he his. I think that most everyone 
else thought that it was terrible when code like this


auto foo(bool) {...}
auto foo(long) {...}

foo(1);

ends up with the bool overload being called, but Walter's 
answer was just to add an int overload if you didn't want 1 to 
call the bool overload.


Yeah, this is bad.

However, I’d hate to rewrite things like:

if (a & (flag1 | flag2))

to

if ((a & (flag1 | flag2)) != 0)

When the first is quite obvious.




[Issue 17957] D shared library throws asserts when called from C detached pthread but not terminated with dlclose

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

--- Comment #3 from Nicolas F.  ---
fwiw, you can get rid of the naughty pthread_join call which would result in
undefined behaviour for detached threads by replacing it with a simple
sleep(3), which will result in the same segfault inside the D runtime,
effectively proving that a completely valid C program can call into completely
valid D code and cause a crash because of the D runtime.

--


Re: Inline assembly question

2017-11-12 Thread Dibyendu Majumdar via Digitalmars-d-learn

On Sunday, 12 November 2017 at 12:32:09 UTC, Basile B. wrote:
On Sunday, 12 November 2017 at 12:17:51 UTC, Dibyendu Majumdar 
wrote:
On Sunday, 12 November 2017 at 11:55:23 UTC, Eugene Wissner 
wrote:

[...]


Thank you - I probably could use something like this. It is 
uglier than the simpler approach in dynasm of course.


How about when I need to combine this with some struct/union 
access? In dynasm I can write:


  |  mov BASE, CI->u.l.base // BASE = 
ci->u.l.base (volatile)
  |  mov PC, CI->u.l.savedpc// PC = 
CI->u.l.savedpc


How can I mix the mixin above and combine with struct offsets?



https://dlang.org/spec/iasm.html#agregate_member_offsets

aggregate.member.offsetof[someregister]


Sorry I didn't phrase my question accurately. Presumably to use 
above with the mnemonics I would need additional mixin templates 
where the aggregate type and member etc would need to be 
parameters?





Re: Class allocators

2017-11-12 Thread Eduard Staniloiu via Digitalmars-d-learn

On Saturday, 11 November 2017 at 14:26:34 UTC, Nordlöw wrote:

Have anybody used allocators to construct class instances?


I might be wrong, but I think you are looking for 
std.experimental.allocator.make [0]


[0] - 
https://dlang.org/phobos/std_experimental_allocator.html#make


Re: Inline assembly question

2017-11-12 Thread Eugene Wissner via Digitalmars-d-learn
On Sunday, 12 November 2017 at 15:25:43 UTC, Dibyendu Majumdar 
wrote:

On Sunday, 12 November 2017 at 12:32:09 UTC, Basile B. wrote:
On Sunday, 12 November 2017 at 12:17:51 UTC, Dibyendu Majumdar 
wrote:
On Sunday, 12 November 2017 at 11:55:23 UTC, Eugene Wissner 
wrote:

[...]


Thank you - I probably could use something like this. It is 
uglier than the simpler approach in dynasm of course.


How about when I need to combine this with some struct/union 
access? In dynasm I can write:


  |  mov BASE, CI->u.l.base // BASE = 
ci->u.l.base (volatile)
  |  mov PC, CI->u.l.savedpc// PC = 
CI->u.l.savedpc


How can I mix the mixin above and combine with struct offsets?



https://dlang.org/spec/iasm.html#agregate_member_offsets

aggregate.member.offsetof[someregister]


Sorry I didn't phrase my question accurately. Presumably to use 
above with the mnemonics I would need additional mixin 
templates where the aggregate type and member etc would need to 
be parameters?


You can use just string parameters instead of enums, then you can 
pass arbitrary arguments to the instructions. The compiler will 
tell you if something is wrong with the syntax of the generated 
assembly.


Re: Class allocators

2017-11-12 Thread Per Nordlöw via Digitalmars-d-learn
On Sunday, 12 November 2017 at 18:34:42 UTC, Eduard Staniloiu 
wrote:

On Saturday, 11 November 2017 at 14:26:34 UTC, Nordlöw wrote:

Have anybody used allocators to construct class instances?


I might be wrong, but I think you are looking for 
std.experimental.allocator.make [0]


[0] - 
https://dlang.org/phobos/std_experimental_allocator.html#make


Thanks!

In the example the classes are declared as static. What effect 
does this have here and is it required for classes allocated via 
make?


Re: Inline assembly question

2017-11-12 Thread Dibyendu Majumdar via Digitalmars-d-learn

On Sunday, 12 November 2017 at 18:48:02 UTC, Eugene Wissner wrote:

https://dlang.org/spec/iasm.html#agregate_member_offsets

aggregate.member.offsetof[someregister]


Sorry I didn't phrase my question accurately. Presumably to 
use above with the mnemonics I would need additional mixin 
templates where the aggregate type and member etc would need 
to be parameters?


You can use just string parameters instead of enums, then you 
can pass arbitrary arguments to the instructions. The compiler 
will tell you if something is wrong with the syntax of the 
generated assembly.


Okay thank you. Sigh. It would be so much simpler to be able to 
just define mnemonics for registers.


Anyway, another question:

Does the compiler generate appropriate unwind information on 
Win64? Prsumably if a function is marked 'naked' then it doesn't?


Thanks and Regards
Dibyendu



How do I use Socket.select?

2017-11-12 Thread Anonymouse via Digitalmars-d-learn
I've been using blocking Sockets with timeouts for a while now, 
but wherever I look the word is "do consider using a non-blocking 
socket". Even the docs for std.socket.setOption;


In a typical application, you might also want to consider using 
a non-blocking socket instead of setting a timeout on a 
blocking one.


So I'm trying to wrap my head around select but I can't get it to 
work in any way that's better than my current blocking reads.


A SocketSet is a bundle of Sockets that you can add to and remove 
from, but you can't index. They're just there but out of reach.


A call to Socket.select(SocketSet readers, SocketSet writers, 
SocketSet error) *blocks* (unless supplied a timeout), and when 
something happens returns a number telling you how many sockets 
changed status, but not which.


The Sockets of those three SocketSets now magically disassociated 
themselves if they weren't one of those that changed status. You 
then have to call {readers,writers,error}.isSet(mySocket) and 
manually delve which one is still in there, and by extension, 
which one did change.


But a "status change" for a reading Socket is "stuff can now 
connect", for a writing one "connection established", and not 
sure about the error ones. It doesn't seem to be "there's data 
waiting to be read" which I'd hoped for, since my program (IRC 
bot) in essence connects once and stays such throughout its life.


What else is there to select that I'm missing? Or is it mostly a 
thing for programs with lots of Sockets, lots of connections?


[Issue 16318] inherit from interface via abstract class

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

ponce  changed:

   What|Removed |Added

 CC||alil...@gmail.com

--- Comment #6 from ponce  ---
I lost a lot of time on that issue


-

interface A
{

void lol();
}

abstract class B : A
{
}

class C : B
{
   override void lol()
   {
   }
}

--

Error: function f891.C.lol does not override any function, did you mean to
override 'f891.A.lol'?


--


It's very unclear and unpexpected that the proper fix is just to remove the
"override" keyword.

--


Re: Inline assembly question

2017-11-12 Thread Basile B. via Digitalmars-d-learn
On Sunday, 12 November 2017 at 21:27:28 UTC, Dibyendu Majumdar 
wrote:
On Sunday, 12 November 2017 at 18:48:02 UTC, Eugene Wissner 
wrote:

https://dlang.org/spec/iasm.html#agregate_member_offsets

aggregate.member.offsetof[someregister]


Sorry I didn't phrase my question accurately. Presumably to 
use above with the mnemonics I would need additional mixin 
templates where the aggregate type and member etc would need 
to be parameters?


You can use just string parameters instead of enums, then you 
can pass arbitrary arguments to the instructions. The compiler 
will tell you if something is wrong with the syntax of the 
generated assembly.


Okay thank you. Sigh. It would be so much simpler to be able to 
just define mnemonics for registers.


Anyway, another question:

Does the compiler generate appropriate unwind information on 
Win64? Prsumably if a function is marked 'naked' then it 
doesn't?


Thanks and Regards
Dibyendu


yeah about stack frame..., also don't forget to mark the asm 
block "pure nothrow" if possible...

It's not documented but the syntax is like that:

```
void foo()
{
asm pure nothrow
{
naked;
ret;
}
}

```



Re: Inline assembly question

2017-11-12 Thread Dibyendu Majumdar via Digitalmars-d-learn

On Sunday, 12 November 2017 at 22:00:58 UTC, Basile B. wrote:

On Sunday, 12 November 2017 at 21:27:28 UTC, Dibyendu Majumdar


Does the compiler generate appropriate unwind information on 
Win64? Prsumably if a function is marked 'naked' then it 
doesn't?


yeah about stack frame..., also don't forget to mark the asm 
block "pure nothrow" if possible...

It's not documented but the syntax is like that:

```
void foo()
{
asm pure nothrow
{
naked;
ret;
}
}

```


I am not sure I have understood above; will DMD generate the 
right Win64 unwind info for this contrived example:


int luaV_interp(lua_State *L)
{
asm pure nothrow {
naked;
push RDI;
push RSI;
push RBX;
push R12;
push R13;
push R14;
push R15;
sub RSP, 5*8;
mov  RAX, 0;
add RSP, 5*8;
pop R15;
pop R14;
pop R13;
pop R12;
pop RBX;
pop RSI;
pop RDI;
pop RBP;
ret;
}
}




Re: Inline assembly question

2017-11-12 Thread Basile B. via Digitalmars-d-learn
On Sunday, 12 November 2017 at 22:20:46 UTC, Dibyendu Majumdar 
wrote:

On Sunday, 12 November 2017 at 22:00:58 UTC, Basile B. wrote:

On Sunday, 12 November 2017 at 21:27:28 UTC, Dibyendu Majumdar
I am not sure I have understood above; will DMD generate the 
right Win64 unwind info for this contrived example:


no in naked mode you have to save and restore by hand.



Re: Class allocators

2017-11-12 Thread Basile B. via Digitalmars-d-learn

On Sunday, 12 November 2017 at 18:46:54 UTC, Per Nordlöw wrote:
On Sunday, 12 November 2017 at 18:34:42 UTC, Eduard Staniloiu 
wrote:

On Saturday, 11 November 2017 at 14:26:34 UTC, Nordlöw wrote:

Have anybody used allocators to construct class instances?


I might be wrong, but I think you are looking for 
std.experimental.allocator.make [0]


[0] - 
https://dlang.org/phobos/std_experimental_allocator.html#make


Thanks!

In the example the classes are declared as static. What effect 
does this have here and is it required for classes allocated 
via make?


No, the classes and structs of the examples are simply declared 
as 'static' because they are located in a 'unittest' block. You 
can ignore the keyword...it just means that they are declared as 
if they would stand at the global scope.


Re: Deprecate implicit `int` to `bool` conversion for integer literals

2017-11-12 Thread Dmitry Olshansky via Digitalmars-d
On Sunday, 12 November 2017 at 16:00:28 UTC, Ola Fosheim Grøstad 
wrote:
On Sunday, 12 November 2017 at 13:34:50 UTC, Dmitry Olshansky 
wrote:

if (a & (flag1 | flag2))

to

if ((a & (flag1 | flag2)) != 0)

When the first is quite obvious.


Just change the typing of the if-conditional to:

if (boolean|integral) {…}


Rather I recall that:
if(expr)
is considered to be
if(cast(bool)expr)

The latter to support user-defined types.
So we are good.


Re: Deprecate implicit `int` to `bool` conversion for integer literals

2017-11-12 Thread Jonathan M Davis via Digitalmars-d
On Sunday, November 12, 2017 19:13:00 Dmitry Olshansky via Digitalmars-d 
wrote:
> On Sunday, 12 November 2017 at 16:00:28 UTC, Ola Fosheim Grøstad
>
> wrote:
> > On Sunday, 12 November 2017 at 13:34:50 UTC, Dmitry Olshansky
> >
> > wrote:
> >> if (a & (flag1 | flag2))
> >>
> >> to
> >>
> >> if ((a & (flag1 | flag2)) != 0)
> >>
> >> When the first is quite obvious.
> >
> > Just change the typing of the if-conditional to:
> >
> > if (boolean|integral) {…}
>
> Rather I recall that:
> if(expr)
> is considered to be
> if(cast(bool)expr)
>
> The latter to support user-defined types.
> So we are good.

Yes. In conditional expressions, you get an implicitly inserted cast to
bool. So, you have an implicit, explicit cast to bool (weird as that
sounds). If the implicit cast to integers to bool were removed (meaning
neither integer literals nor VRP allowed the conversion), then it would have
no effect on if statements or loops and whatnot. It would affect
overloading and other expressions. So, something like

bool a = 2 - 1;

or

auto foo(bool) {...}
foo(1);

wouldn't compile anymore. But something like

if(1)

would compile just fine, just like

if("str")

compiles just fine, but

auto foo(bool) {...}
foo("str");

does not.

- Jonathan M Davis




Re: Class allocators

2017-11-12 Thread Nordlöw via Digitalmars-d-learn

On Sunday, 12 November 2017 at 20:41:03 UTC, Basile B. wrote:
No, the classes and structs of the examples are simply declared 
as 'static' because they are located in a 'unittest' block. You 
can ignore the keyword...it just means that they are declared 
as if they would stand at the global scope.


Thanks.


Re: LDC 1.6.0-beta1

2017-11-12 Thread Nordlöw via Digitalmars-d-announce

On Sunday, 12 November 2017 at 15:57:19 UTC, kinke wrote:

Hi everyone,

on behalf of the LDC team, I'm glad to announce the first beta 
for LDC 1.6. The highlights of this version in a nutshell:


* Based on D 2.076.1.
* Experimental support for dynamic codegen at runtime ('manual 
JIT').

* Many std.math functions are now CTFE-able.

Full release log and downloads: 
https://github.com/ldc-developers/ldc/releases/tag/v1.6.0-beta1


Thanks to all contributors!


Wow, that's fast!

I'm looking forward to discussions concerning the new feature:

dynamic codegen at runtime

Are there any plans on also using LLVMs jit for run-time 
generative (meta) programming?


Re: Deprecate implicit `int` to `bool` conversion for integer literals

2017-11-12 Thread Michael V. Franklin via Digitalmars-d
On Sunday, 12 November 2017 at 16:57:05 UTC, Andrei Alexandrescu 
wrote:


A DIP could be formulated to only address the problem at hand. 
BTW, here's a really fun example:


void fun(long) { assert(0); }
void fun(bool) {}

enum int a = 2;
enum int b = 1;

void main()
{
fun(a - b);
}

The overload being called depends on (a) whether a - b can be 
computed during compilation or not, and (b) the actual value of 
a - b. Clearly a big problem for modular code. This is the 
smoking gun motivating the DIP.


As I understand it, the case above can be solved by changing the 
overload resolution rules without deprecating the implicit 
conversion to bool.  A PR for such a fix was submitted here 
https://github.com/dlang/dmd/pull/1942.


I fear a proposal to deprecate the implicit conversion to bool 
based solely on the example above could be refused in favor of 
overload resolution changes.  IMO, the example above, while 
certainly a smoking gun, is actually just a symptom of the deeper 
problem, so I tried to make that case in the DIP.


The DIP has been submitted here 
https://github.com/dlang/DIPs/pull/99


Perhaps I'm not the right person to be formulating these 
arguments, but given that the issue has been in Bugzilla for 4 
years, I'm probably all you've got.  Sorry.


Mike




Re: [OT] mobile rising

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

On 11/10/2017 2:54 PM, codephantom wrote:

 MSFT fanboy...at it again...


Knock it off, everyone.



Re: Inline assembly question

2017-11-12 Thread Dibyendu Majumdar via Digitalmars-d-learn

On Sunday, 12 November 2017 at 22:24:08 UTC, Basile B. wrote:
On Sunday, 12 November 2017 at 22:20:46 UTC, Dibyendu Majumdar 
wrote:

On Sunday, 12 November 2017 at 22:00:58 UTC, Basile B. wrote:

On Sunday, 12 November 2017 at 21:27:28 UTC, Dibyendu Majumdar
I am not sure I have understood above; will DMD generate the 
right Win64 unwind info for this contrived example:


no in naked mode you have to save and restore by hand.


So how does one manually generate the .pdata and .xdata sections?
Are you saying that this is what I would need to do?

Another question - how can I tell DMD to no generate the frame 
pointer?


Thanks for answering my questions.

Regards
Dibyendu



[Issue 16398] aligned allocator: aligned reallocation is not defined

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

Basile B.  changed:

   What|Removed |Added

 CC||b2.t...@gmx.com

--- Comment #1 from Basile B.  ---
This is an ER only for Posix actually. Under Windows, 
1. the MS std C lib has the right primitive.
2. the allocator has custom primitives for the Mars std C lib (which does a new
alloc + copy)

Under Posix, the alligned alloc routines exist but only alloc / free.
So because of 2. i don't see why alloc + copy wouldn't not be done for Posix.

--


[Issue 16398] aligned allocator: add aligned reallocation for Posix

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

Basile B.  changed:

   What|Removed |Added

Summary|aligned allocator: aligned  |aligned allocator: add
   |reallocation is not defined |aligned reallocation for
   ||Posix

--


[Issue 16398] experimental allocators, add aligned reallocation for Posix

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

Basile B.  changed:

   What|Removed |Added

Summary|aligned allocator: add  |experimental allocators,
   |aligned reallocation for|add aligned reallocation
   |Posix   |for Posix

--