Re: reasoning of evaluating code after return in current block (static if return)

2017-05-07 Thread bastien penavayre via Digitalmars-d

On Sunday, 7 May 2017 at 23:20:26 UTC, Adam D. Ruppe wrote:


I would just write it `else static if` all on one line and not 
indent further. Then it barely looks any different anyway.


I just realized that I accidentally posted this while editing.
I agree with you on that this is barely different from just 
adding "else".


The example that I wanted to put was the following.

{
enum index = ...;
static if (I >= args.length)
   return ...; //uses index
else
{
   enum result = ...;
   static if (!result[0])
   {
  static if (name.length == 0)
 return ...;
  else static if (result[2] >= txt.length)
 return ...;
  else
 return ...;
   }
   else
   {
  enum next = ...;
  static if (!next[0])
 return ...;
  else
  {
 ...
 return ...;
  }
   }
   }
}


Re: reasoning of evaluating code after return in current block (static if return)

2017-05-07 Thread Adam D. Ruppe via Digitalmars-d

On Sunday, 7 May 2017 at 22:34:14 UTC, bastien penavayre wrote:

Why is the code following "return true" evaluated ?


It isn't evaluated, it is just compiled. The compile happens 
before it is run, so it doesn't really know if it is reachable 
yet.



ClLinearExpression opBinary(string op) (double constant)
{
static if (op == "+")
return new ClLinearExpression(this, 1, constant);
else
static if (op == "-")
return new ClLinearExpression(this, 1, 
-constant);

else
static if (op == "*")
return new ClLinearExpression(this, 
constant, 0);

else
static if (op == "/")
return new ClLinearExpression(this, 1.0 
/ constant, 0);

}


I would just write it `else static if` all on one line and not 
indent further. Then it barely looks any different anyway.


reasoning of evaluating code after return in current block (static if return)

2017-05-07 Thread bastien penavayre via Digitalmars-d

Hi something's been bugging me for a while,
for the following code:

{
   auto t = tuple(0,0);
   return true;
   auto v = t[5];
   return false;
}

Why is the code following "return true" evaluated ? I know that 
it's the same

with the C++ but I was wondering why ?
My guess is for goto/labels but I find odd to evaluate it by 
default.
Furthermore one of my issues with this is that it has a negative 
impact on "static if" and make it cumbersome in some situations.


For instance this snippet comming from 
"https://github.com/uncrustify/uncrustify/issues/252";


ClLinearExpression opBinary(string op) (double constant)
{
static if (op == "+")
return new ClLinearExpression(this, 1, constant);
else
static if (op == "-")
return new ClLinearExpression(this, 1, -constant);
else
static if (op == "*")
return new ClLinearExpression(this, constant, 
0);

else
static if (op == "/")
return new ClLinearExpression(this, 1.0 / 
constant, 0);

}


Re: DLang quarterly EU?

2017-05-07 Thread John Colvin via Digitalmars-d

On Saturday, 6 May 2017 at 23:53:45 UTC, Ethan Watson wrote:
I was speaking to Atila earlier about the things we like about 
DConf. Sitting around talking to a bunch of computer scientists 
is fantastic, and not something people generally get to do in 
their chosen careers as a programmer.


EU nations are quite close together. Rather than a city meet up 
monthly, what about a continental meet up quarterly?


This is quite feasible in Europe, since everything is quite 
close together. I'm keen. Atila is keen. Anyone else think this 
is a great idea?


Great idea. I'm in.


Re: DLang quarterly EU?

2017-05-07 Thread David Nadlinger via Digitalmars-d

On Saturday, 6 May 2017 at 23:53:45 UTC, Ethan Watson wrote:
This is quite feasible in Europe, since everything is quite 
close together. I'm keen. Atila is keen. Anyone else think this 
is a great idea?


I'd definitely be interested as well. —David


Re: DLang quarterly EU?

2017-05-07 Thread Moritz Maxeiner via Digitalmars-d

On Saturday, 6 May 2017 at 23:53:45 UTC, Ethan Watson wrote:
I was speaking to Atila earlier about the things we like about 
DConf. Sitting around talking to a bunch of computer scientists 
is fantastic, and not something people generally get to do in 
their chosen careers as a programmer.


EU nations are quite close together. Rather than a city meet up 
monthly, what about a continental meet up quarterly?


This is quite feasible in Europe, since everything is quite 
close together. I'm keen. Atila is keen. Anyone else think this 
is a great idea?


Superb!


Re: DLang quarterly EU?

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

On Sunday, 7 May 2017 at 16:37:02 UTC, Ethan Watson wrote:

On Sunday, 7 May 2017 at 11:32:53 UTC, Adam Wilson wrote:

On 5/7/17 12:57, Seb wrote:
+1 - maybe its worth considering to make it for two days 
(=one weekend)


That can work. It would be two or three days vacation 
depending on flight schedules.

...
Not to mention a cool way to see new cities if it moves around.


Yes, that was the intention on both counts. There's no point to 
flying somewhere just for the day. Especially since there will 
doubtless be Micro BeerConfs in the evening ;-)


Andrei suggested that Bucharest be the first city we hold this 
in. Sounds like a great plan to me.


Count me in!



Re: DLang quarterly EU?

2017-05-07 Thread Ethan Watson via Digitalmars-d

On Sunday, 7 May 2017 at 11:32:53 UTC, Adam Wilson wrote:

On 5/7/17 12:57, Seb wrote:
+1 - maybe its worth considering to make it for two days (=one 
weekend)


That can work. It would be two or three days vacation depending 
on flight schedules.

...
Not to mention a cool way to see new cities if it moves around.


Yes, that was the intention on both counts. There's no point to 
flying somewhere just for the day. Especially since there will 
doubtless be Micro BeerConfs in the evening ;-)


Andrei suggested that Bucharest be the first city we hold this 
in. Sounds like a great plan to me.


Re: Upgrading the minimum version of FreeBSD supported

2017-05-07 Thread Jonathan M Davis via Digitalmars-d
On Sunday, April 2, 2017 8:40:15 PM CEST Brad Roberts via Digitalmars-d 
wrote:
> I grabbed the official 10.3-CURRENT vm image from the freebsd website
> and gave it a whirl.  For the 64 bit test run, the only failure was
> std.datetime unit tests failure.  Apparently LocalTime().stdName is null
> and the assert at line 28248 fails. There's at least one additional
> failure on 32 bits in allocator/building_blocks/region.d line 652.  I
> ran out of time to dig for today, but the bottom line is that 10.3 isn't
> ready to be the base platform for dmd as is.  Chances are it could be
> with only a little work though.

The std.datetime failure is due to known FreeBSD bug, but it's affected by
the local time, and apparently, it works in America/Los_Angeles but not in
UTC (which is why I wasn't seeing it). I'll commit a workaround shortly,
though I still need to figure out how to push the fix in FreeBSD through so
that FreeBSD doesn't have the bug anymore...

- Jonathan M Davis



-vcg-ast dmd command line switch

2017-05-07 Thread Ali Çehreli via Digitalmars-d

I've just commented on the following thread on the 'internals' newsgroup:

  http://forum.dlang.org/thread/tiiuucwivajgsnoos...@forum.dlang.org

I think this should be improved to display code that is being mixed-in.

Ali


Re: DLang quarterly EU?

2017-05-07 Thread Johan Engelen via Digitalmars-d

On Saturday, 6 May 2017 at 23:53:45 UTC, Ethan Watson wrote:
... Rather than a city meet up monthly, what about a 
continental meet up quarterly?


... Anyone else think this is a great idea?


+1 !

-Johan




Re: Interesting PRs: bringing type system legitimacy to shared allocators

2017-05-07 Thread Stanislav Blinov via Digitalmars-d

On Sunday, 7 May 2017 at 11:46:33 UTC, Andrei Alexandrescu wrote:

On 5/7/17 1:30 PM, Stanislav Blinov wrote:




To follow this discussion up, and in light of yesterday's 
Collections presentation at DConf, I though I'd go ahead and 
make a basic implementation of traits-based IAllocator.


You can find it here:

https://github.com/radcapricorn/alloctraits


Cool, thanks. Before we saw that, Eduard and I are working on a 
similar solution along the lines of IAllocator!(Flag!"nogc", 
Flag!"safe"). -- Andrei


I guess the exact representation of "traits" is something to 
decide on. I have to say, even though I used the BitFlags-based 
solution, I'm not a big fan of that, the syntax is a bit 
unwieldy. Then again, Flag-based would be too.

Perhaps a struct with enum members could be used...


Re: Interesting PRs: bringing type system legitimacy to shared allocators

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

On 5/7/17 1:30 PM, Stanislav Blinov wrote:




To follow this discussion up, and in light of yesterday's Collections 
presentation at DConf, I though I'd go ahead and make a basic 
implementation of traits-based IAllocator.


You can find it here:

https://github.com/radcapricorn/alloctraits


Cool, thanks. Before we saw that, Eduard and I are working on a similar 
solution along the lines of IAllocator!(Flag!"nogc", Flag!"safe"). -- Andrei


Re: DLang quarterly EU?

2017-05-07 Thread Adam Wilson via Digitalmars-d

On 5/7/17 12:57, Seb wrote:

On Sunday, 7 May 2017 at 06:58:51 UTC, Adam Wilson wrote:

On 5/7/17 07:41, Walter Bright wrote:

Dang, I wish I could participate in that!


Well, technically you could, but it involves a set of rather grueling
flights.

Depending on the day it's held I might be able to attend once a year.
If it's on the weekend, I can make a long weekend out of it.


+1 - maybe its worth considering to make it for two days (=one weekend),
s.t. the flight is not longer than the meetup?


That can work. It would be two or three days vacation depending on 
flight schedules. It is certainly workable. And it would be a lot of fun 
to get together to discuss D and hack on projects. Not to mention a cool 
way to see new cities if it moves around. :)


--
Adam Wilson
IRC: LightBender
import quiet.dlang.dev;


Re: Interesting PRs: bringing type system legitimacy to shared allocators

2017-05-07 Thread Stanislav Blinov via Digitalmars-d

On Monday, 1 May 2017 at 13:00:27 UTC, Andrei Alexandrescu wrote:

On 05/01/2017 08:12 AM, Guillaume Piolat wrote:
On Sunday, 30 April 2017 at 21:43:26 UTC, Andrei Alexandrescu 
wrote:


A pass through the root allocators (Mallocator, GCAllocator 
etc)
figuring out what attributes could be meaningfully attached 
would be

welcome. The rest would rely on inference.


Thanks,

Andrei


IAllocator being fully @nogc would be a comforting guarantee, 
as runtime

dispatch makes for lighter types.


As I said (and am encouraging you to do this), this is achieved 
through simple variance:


interface INoGCAllocator : IAllocator {
   ... override all methods here as @nogc ...
}

This is possible because a @nogc method may override one that 
is not @nogc. @nogc being more restrictive it is contravariant 
with no-@nogc.


Also IAllocator should have a few @nogc methods to start with; 
there's no reason e.g. for empty() to create garbage.


Could you please initiate a PR?


Andrei


To follow this discussion up, and in light of yesterday's 
Collections presentation at DConf, I though I'd go ahead and make 
a basic implementation of traits-based IAllocator.


You can find it here:

https://github.com/radcapricorn/alloctraits

It pretty much evades the shortcomings of IAllocator, alleviates 
the need for any additional interfaces (ISharedAllocator et al.), 
at the cost of making user code slightly more verbose. But that 
is a small price to pay if we want to benefit from the type 
system.
The current implementation lacks a few features of 
std.experimental.allocator (i.e. passing implementation by 
pointer), which are easy to add, I was just focused mainly on 
roughing out the design as the first step.


Anyone interested, feel free to comment, improve, bash, destroy...


Re: DLang quarterly EU?

2017-05-07 Thread Seb via Digitalmars-d

On Sunday, 7 May 2017 at 06:58:51 UTC, Adam Wilson wrote:

On 5/7/17 07:41, Walter Bright wrote:

Dang, I wish I could participate in that!


Well, technically you could, but it involves a set of rather 
grueling flights.


Depending on the day it's held I might be able to attend once a 
year. If it's on the weekend, I can make a long weekend out of 
it.


+1 - maybe its worth considering to make it for two days (=one 
weekend), s.t. the flight is not longer than the meetup?


Re: Thank You DConf 2017

2017-05-07 Thread Bastiaan Veelo via Digitalmars-d

On Saturday, 6 May 2017 at 16:44:00 UTC, Stanislav Blinov wrote:
Fantastic three days of presentations. A big Thank You to all 
presenters, organizers and sponsors, and a special Thank You to 
the team that made the livestream possible, so even those of us 
who couldn't make it to Berlin could not only learn from the 
conference but actually participate.
An awesome event and lots of food for thought, exploration, 
experimentation and implementation. Thank You!


I agree completely. I have been following previous DConfs online, 
and fantasising that I might attend one, one day. That it would 
be this one I had not anticipated and feel honoured to have been 
asked to present, it is a great compliment that the things that 
occupy me would be interesting to a wider audience. It has been a 
rewarding experience (and still is during this hackathon), the 
conversations and chats I have had with so many smart people will 
bring me closer to my goals, and give me energy. The atmosphere 
here is amazing, and I am enjoying myself tremendously.


So thank you all indeed!

Bastiaan.


London DLang

2017-05-07 Thread Russel Winder via Digitalmars-d
Really a message to John Colvin, but I lost his email…

Kingsley made two attempts to start a DLang London meet up, maybe third
time lucky?

It is worth noting that Phil Nash started a C++ London group a few
months back and now gets 100+ at each meeting. Clearly there is huge
interest in C++ in London that was untapped till recently. Maybe we
could do a D pitch to the C++ folk, especially based on mixed
codebases?

Given C++17 and it's parallelism support, plus that Herb may well get
metaclasses into C++20, what is the angle that gets C++ folk to D these
days? Or is it that that opportunity has now passed given the changes
in C++?

Gerald did a great pitch for D as the replacement for Vala (and C++)
for Gtk. Maybe that is an angle, maybe get D as an official binging
based on LDC?
 
Then there is the Python angle. I know the "data science" mindset is
Python/NumPy/Pandas/Matplotlib (yes R is still a factor) and that is
unlikely ever to be supplanted successfully in the short and medium
term. But maybe worth thinking what a D-centric approach might be.
Laeeth has often championed D over Python in finance.

I suspect I will be doing a Python/Chapel pitch at PyConUK this year,
trying to get Pythonistas to understand what real computation is: 10
processors, pah, I want 10,000 processors working on this. If anyone
wants to get a Python/D pitch in there, I'd be there to cheer.

One thing that is clear in the Python community is that presentational
sessions get an audience, and code dojo, actual programming sessions
get an audience. Maybe there is a role for a D meeting where people
turn up and actually just do some programming, either code dojo, or
working on something specific.

Sadly working on the IntelliJ IDEA plugin would be great but that is
Kotlin (and Java) programming.

Oh and are people thinking of proposing D-related sessions to ACCU
2018? The call for proposals will go out 2017-10.

-- 
Russel.
=
Dr Russel Winder  t: +44 20 7585 2200   voip: sip:russel.win...@ekiga.net
41 Buckmaster Roadm: +44 7770 465 077   xmpp: rus...@winder.org.uk
London SW11 1EN, UK   w: www.russel.org.uk  skype: russel_winder

signature.asc
Description: This is a digitally signed message part


Re: DLang quarterly EU?

2017-05-07 Thread Mike Parker via Digitalmars-d

On Sunday, 7 May 2017 at 06:58:51 UTC, Adam Wilson wrote:

On 5/7/17 07:41, Walter Bright wrote:

Dang, I wish I could participate in that!


Well, technically you could, but it involves a set of rather 
grueling flights.


Depending on the day it's held I might be able to attend once a 
year. If it's on the weekend, I can make a long weekend out of 
it.


It's a long haul for me, but I'd also be willing to hop over once 
a year beyond DConf. Good excuse for a vacation.


Re: DLang quarterly EU?

2017-05-07 Thread Adam Wilson via Digitalmars-d

On 5/7/17 07:41, Walter Bright wrote:

Dang, I wish I could participate in that!


Well, technically you could, but it involves a set of rather grueling 
flights.


Depending on the day it's held I might be able to attend once a year. If 
it's on the weekend, I can make a long weekend out of it.


--
Adam Wilson
IRC: LightBender
import quiet.dlang.dev;