Re: Alias Vs. Enum?

2018-01-06 Thread Stefan Koch via Digitalmars-d

On Saturday, 6 January 2018 at 21:33:46 UTC, Rubn wrote:
Is there a reason for the differences between Enum and Alias? 
For the most part enums are only used for things that have a 
value, but alias is used more for types. But with templates you 
can get around this and you basically get the funcitonality of 
Enum for alias. Oddly enough from the template parameter being 
"alias".



template valueOf(alias v)
{

}

alias aa = AliasSeq!(10 == 10);
enum  ee = 10 == 10;

alias err = 10 == 10; // error

What are the actually differences here with aa and ee?


The compiler can only alias to symbols and not to values.
therefore enum was chosen for manifest constants.

That alias can bind to values in template-parameters is useful 
but not exactly consistent :)


Re: Dscanner: intentionally unused variable

2018-01-06 Thread SimonN via Digitalmars-d

On Sunday, 7 January 2018 at 00:18:27 UTC, Ivan Trombley wrote:
While working with SDL, I found that I kept using the same 
pattern over and over:

- Get the current clip rectangle.
- Set a new clip rectangle.
- restore the old clip rectangle on scope (exit).

Instead of writing that code again and again, I wrote a simple 
function that returns a struct which restores the old clip 
rectangle in it's destructor. This works great but now dscanner 
complains about the variable being unused.


Is there a way tell dscanner that a variable is intentionally 
unused?


Another way would be to have the RAII wrapper in a with 
statement, but it produces extra indentation, which you might not 
like:


with (MyStruct(100, 200)) {
// code that uses the new clip rectangle
}

-- Simon


Re: Dll support: testers needed

2018-01-06 Thread rikki cattermole via Digitalmars-d

+infinity

Few things I would like answered:

- Why -useShared and not -fPIC?
  - If -useShared why not use it on *nix to turn on -fPIC?
- Why isn't DllIsUsedFromC.no automatically detected?

Regarding C-runtime, yes we need to distribute every version that we 
support on Windows. The compiler will pick the latest (or the installer 
I guess) to use, but we should be able to switch between them. Either 
that or we ship a static lib of Phobos to be linked into a dll upon 
first request of a specific C-runtime.


Re: Dscanner: intentionally unused variable

2018-01-06 Thread H. S. Teoh via Digitalmars-d
On Sun, Jan 07, 2018 at 12:18:27AM +, Ivan Trombley via Digitalmars-d wrote:
> While working with SDL, I found that I kept using the same pattern over and
> over:
> - Get the current clip rectangle.
> - Set a new clip rectangle.
> - restore the old clip rectangle on scope (exit).
> 
> Instead of writing that code again and again, I wrote a simple
> function that returns a struct which restores the old clip rectangle
> in it's destructor.  This works great but now dscanner complains about
> the variable being unused.
> 
> Is there a way tell dscanner that a variable is intentionally unused?

IMO, dscanner should be fixed to suppress that warning when the variable
in question has a non-trivial dtor that may produce side-effects at the
end of the scope. In such cases, it may be that the whole reason for the
variable is to trigger the dtor's side-effects, as is your case here, so
technically it isn't "unused".


T

-- 
Don't throw out the baby with the bathwater. Use your hands...


Dscanner: intentionally unused variable

2018-01-06 Thread Ivan Trombley via Digitalmars-d
While working with SDL, I found that I kept using the same 
pattern over and over:

- Get the current clip rectangle.
- Set a new clip rectangle.
- restore the old clip rectangle on scope (exit).

Instead of writing that code again and again, I wrote a simple 
function that returns a struct which restores the old clip 
rectangle in it's destructor. This works great but now dscanner 
complains about the variable being unused.


Is there a way tell dscanner that a variable is intentionally 
unused?


Re: Dll support: testers needed

2018-01-06 Thread Rubn via Digitalmars-d
Looks good. If you want testers though, providing binaries would 
be beneficial. Compiling dmd/druntime/phobos on Windows can be a 
pain.


Re: Alias Vs. Enum?

2018-01-06 Thread Timon Gehr via Digitalmars-d

On 06.01.2018 22:36, Rubn wrote:

Tab + Enter + No Delete/Edit = :/


template valueOf(alias v) // <-- alias
{
     alias valueOf = v;
}

alias aa = valueOf!(10 == 10);
enum  ee = 10 == 10;

alias err = 10 == 10; // error


Can't alias just be extended to support enum values as well instead of 
having this workaround with templates?


Yes, it can.

Is there any reason this hasn't 
already been done?






Nobody stepped up and did it, I guess.

I might write a DIP to clean up the language grammar at some point. 
(There are a few more cases like this one.)


Re: vibe.d Error only with Firefox

2018-01-06 Thread crimaniak via Digitalmars-d
On Friday, 5 January 2018 at 16:30:07 UTC, Martin Tschierschke 
wrote:

...

Failed to listen on 127.0.0.1:8030
Failed to listen on 10.0.0.1:8030

...
The strange thing is now, that when using Chromium 
http://10.0.0.1:8030 works!

But with Firefox http://10.0.0.1:8030
gives the long Error:
400 - Bad Request


I would first figure out what happens to the port 8030. Run this 
command before and after starting the application to see who is 
really listening:

sudo netstat -nlp | grep 8030


Re: Alias Vs. Enum?

2018-01-06 Thread Rubn via Digitalmars-d

Tab + Enter + No Delete/Edit = :/


template valueOf(alias v) // <-- alias
{
alias valueOf = v;
}

alias aa = valueOf!(10 == 10);
enum  ee = 10 == 10;

alias err = 10 == 10; // error


Can't alias just be extended to support enum values as well 
instead of having this workaround with templates? Is there any 
reason this hasn't already been done?






Alias Vs. Enum?

2018-01-06 Thread Rubn via Digitalmars-d
Is there a reason for the differences between Enum and Alias? For 
the most part enums are only used for things that have a value, 
but alias is used more for types. But with templates you can get 
around this and you basically get the funcitonality of Enum for 
alias. Oddly enough from the template parameter being "alias".



template valueOf(alias v)
{

}

alias aa = AliasSeq!(10 == 10);
enum  ee = 10 == 10;

alias err = 10 == 10; // error

What are the actually differences here with aa and ee?


Re: How do you use D?

2018-01-06 Thread Andre Pany via Digitalmars-d

On Thursday, 4 January 2018 at 15:52:15 UTC, Andre Pany wrote:

On Friday, 28 July 2017 at 14:58:01 UTC, Ali wrote:

3) It is not possible to run DMD with the microsoft linker and 
libs without adapting the sc.ini.
That is a pain! In the build infrastructure I can only use the 
dmd zip archive and not
the setup routine. Also the adapation of the sc.ini I need to 
automate in a python script (XMake build plugin).

Python does not like the sc.ini... due to duplicate keys...

Just compare with LDC windows 64. You only have to extract the 
zip archive, call vcvarsall batch

file which sets the environment variables and thats it!
https://issues.dlang.org/show_bug.cgi?id=17967



It seems with the recent version of DMD (2.078.0) there is new 
feature which
solves this problem 
(https://dlang.org/changelog/2.078.0.html#vs-auto-detection)


That's fantastic! Thanks a lot!
I will try it and then close the issue.

Also the new options for customizing the code coverage seems like 
you heard my wishes

within my mind;)

Great work!

Kind regards
André




Re: can't use ldc calypso on OSX; help needed

2018-01-06 Thread Timothee Cour via Digitalmars-d
could anyone with knowledge on druntime shared library loading please
help? (Martin Nowak, klickverbot, Syniurge, etc)

I've made some progress but still failing whenever I try to use C++
std libs eg: `#include `, see

* https://github.com/Syniurge/Calypso/issues/64 (
assert(handle !in _handleToDSO) in setDSOForHandle)

* https://github.com/Syniurge/Calypso/issues/63
error: The module 'ℂcpp.std.type_info' is already defined in
libcalypso-ldc-shared.dylib #63

again, this would make C++ interop much easier and more powerful than
alternatives

On Wed, Dec 13, 2017 at 9:12 PM, Timothee Cour  wrote:
> Has anyone used https://github.com/Syniurge/Calypso on OSX? I'm
> running into a basic issue :
> https://github.com/Syniurge/Calypso/issues/60 which makes any binary
> crash immediately
>
> Making Calypso work would make integration with C++ libraries much
> easier, so it's rather important for dlang.



Re: How do you use D?

2018-01-06 Thread Andre Pany via Digitalmars-d

On Friday, 5 January 2018 at 00:38:05 UTC, Laeeth Isharc wrote:

On Thursday, 4 January 2018 at 15:52:15 UTC, Andre Pany wrote:

On Friday, 28 July 2017 at 14:58:01 UTC, Ali wrote:

[...]


I am working for a german software company. There are various 
programming languages used.
I created several non customer facing tools in D for the 
projects I am involved.
Also I tried to make advertisements for the D Programming 
Language by creating
internal wiki pages, recordings, video channel with screencams 
and telling everyone

about that nice programming language called D.

[...]


Very interesting. Have a look at pegged and the work done by 
Bastian who has also been building a pascal parser - for a 
different dialect.


Thanks for the info, I try to make my parser easiliy replacable 
by a better solution like pegged. For the moment I try to get the 
generator working and cleanup things later. I will also have a 
look at the work of Bastian.


Kind regards
André


Dll support: testers needed

2018-01-06 Thread Benjamin Thaut via Digitalmars-d
I'm currently back on dll support and I'm applying finishing touches to 
my dll support PR. Now I want to know if I missed any corner cases and 
it would be great if a few more people gave the dll support a try.


-To try it out you will need to build dmd, druntime and phobos yourself. 
I'm not going to provide a binary distribution.
-You will need to target the microsoft linker. E.g. either use -m64 or 
-m32mscoff when compiling your programs.
-be warned, the state of the dll support is not final and subject to 
change. There is no garantuee that there won't be any breaking changes 
to dll support.


You can find a quick start guide here: 
http://stuff.benjamin-thaut.de/D/getting_started.html
If you need more information and examples take a look here: 
https://github.com/Ingrater/DIPs/blob/ReviveDIP45/DIPs/DIP45.md


Not all of phobos/druntime has correct export annotations yet as this is 
not the goal of my initial pull request. If you use a function from 
druntime/phobos that does not have a correct export annotation you will 
get a linker error. I'm not interrested in those. I'm interrested in 
cases where export is correctly used and you will still get linker 
errors / incorrect program behavior. So if you encounter a linker error 
first check if the declaration has a export annotation or not. Try 
adding it and see if the error goes away. If it does not go away, report 
it here or send me an e-mail to code at benjamin-thaut.de


If you find anything, small repro cases would be appreciated as it makes 
my life a lot easier.


--
Kind Regards
Benjamin Thaut


Re: vibe.d Error only with Firefox

2018-01-06 Thread WebFreak001 via Digitalmars-d
On Friday, 5 January 2018 at 16:47:53 UTC, Steven Schveighoffer 
wrote:

On 1/5/18 11:30 AM, Martin Tschierschke wrote:

Hello,
when starting my vibe.d service I get the message of failed 
address binding:

Failed to listen on 127.0.0.1:8030
Failed to listen on 10.0.0.1:8030
object.Exception@../../.dub/packages/vibe-d-0.8.2-rc.2/vibe-d/http/vibe/http/server.d(2035):
 Failed to listen for incoming HTTP connections on any of the supplied 
interfaces.


It's attempting to listen on localhost:8030, and 10.0.0.1:8030, 
but can't bind to either address. Then it looks like you get an 
exception. Does it actually continue running?


That error is always there, don't worry about it OP. The issue 
you are having doesn't have anything to do with the binding, 
after all you get a 400 error from the server.



But with Firefox http://10.0.0.1:8030

gives the long Error:
400 - Bad Request

Bad Request

Internal error information:
object.Exception@../../.dub/packages/vibe-d-0.8.2-rc.2/vibe-d/stream/vibe/stream/operations.d(363):
 Reached maximum number of bytes while searching for end marker.


truncated
.
../../.dub/packages/vibe-d-0.8.2-rc.2/vibe-d/core/vibe/core/core.d:1269 void 
vibe.core.core.CoreTask.run() [0x94574a]
??:? void core.thread.Fiber.run() [0xa3c7ff]
??:? fiber_entryPoint [0xa3c562]
??:? [0x]


This looks like a real error that isn't related to the bindings 
(as long as it's not some weird stale server). I'd suggest 
trying to create a minimal example and post it to vibe.d's 
issue tracker.


Also try checking the developer tools of both browsers to see 
what headers they are sending, vibe.d probably has a problem with 
one of those and breaks because of it. But to be sure for sure 
you need to provide a code example.


Re: Some Observations on the D Development Process

2018-01-06 Thread rjframe via Digitalmars-d
On Fri, 05 Jan 2018 18:53:38 -0800, Walter Bright wrote:

> On 1/5/2018 7:39 AM, Seb wrote:
>> We should put things like this somewhere where it can easily be seen by
>> others.
>> The obvious candidates are the Wiki and Bugzilla, but both have
>> historically proven to yield poor results, e.g.
> 
> Sigh. Bugzilla is the answer, and lots of people do troll Bugzilla
> looking for things to do. Adding another list somewhere else is not
> going to improve things.

Note that Andrei (I think) set up a "bootcamp"[1] keyword on bugzilla for 
easy issues a while back; the problem has been solved though maybe not 
advertised consistently. The wiki's "Get Involved" page includes a link to 
preapproved and bootcamp issues. CONTRIBUTING.md also links to it - maybe 
it's just on the forums nobody talks about it...


[1]: https://issues.dlang.org/buglist.cgi?
component=dmd&keywords=bootcamp&product=D


Re: What don't you switch to GitHub issues

2018-01-06 Thread Paolo Invernizzi via Digitalmars-d

On Friday, 5 January 2018 at 22:55:43 UTC, Adam D. Ruppe wrote:

On Friday, 5 January 2018 at 22:45:15 UTC, Walter Bright wrote:

I could easily spend 30 hours per day just reading the n.g.


Learn threads tend to be quite short. Just skim the first post 
in a thread to see what people talk about. It takes mere 
minutes, spread out over the day.


+1

We all have to manage time, me too: for example, I try to give 
advices on something that's specific in my domain, see [1], as 
I've very very little time to spare in d-land...


You wrote [2] that the main problem is "more people doing quality 
work. Not more process".
So It really worth spending your time in coding for compiler 
coloured messages and not in trying to solve that?


As an example for reasoning, you have just written [3] that 
merging PR that are OK but not great is bad, as they resulted in 
more regression to be fixed by you.


Main problem: more people doing quality work.

"""
Dear community, as we are trying to leverage the number of people 
doing quality work on the compiler, we will merge PR that are OK 
but not great, for a Z months period.


We are expecting an increase in the number of people studying and 
working on the compiler, training them to become potential future 
core team members.


In the judgement of the core time, now we have X skilled core 
contributors, while you can find below:
- the numbers for distinct people who opened pull request month 
by month.
- the numbers of regressions open and closed weekly for the past 
period.

- the numbers for OK and great PR pushed in the past.

We are expecting to increase the number of skilled core 
contributors from X to Y at the end of the period, an increase of 
the monthly open regression to K balanced by an increased rate of 
closed regression by Z.

"""

Then, after the period, you simply retake the measure, and you 
have put in front of everybody an evidence.


That is just a fast crafted example, not so pertinent, but it 
gives the idea of what I'm trying to suggest. I would be 
interested in hearing Laeeth opinion on that.


But, where are the metrics? I'm always so marvelled that 
engineers use so often 'their personal impressions' instead of a 
sane, carefully crafted metric (instead of the actual vanity and 
not actionable number of downloads). That would be a good field 
of work for the foundation, for example.


/P

[1] 
http://forum.dlang.org/post/pdbpremnjtuzakkja...@forum.dlang.org

[2] http://forum.dlang.org/post/p2pdn5$8dm$1...@digitalmars.com
[3] http://forum.dlang.org/post/p2pcts$76k$1...@digitalmars.com