Re: What criteria do you take

2014-09-06 Thread Paulo Pinto via Digitalmars-d

Am 06.09.2014 04:30, schrieb Cassio Butrico:

What criteria do you take into consideration for the choice of a
programming language.
and why? does not mention what language would be, but what criteria led
them to choose.


Depends.

At work, I just use whatever the customer asks for. Programming 
languages and target platforms are already part of the request for 
proposals the company receives.


The only way to choose languages is to try to get assigned to projects 
using the said languages, but even then, there isn't a way to control 
what versions are being used, unless it was left undefined.



If choosing for my own hobby projects, expressive, supporting the 
majority of abstractions of the last 30 years that made it into the 
mainstream.


Support for the desired target platforms, availability of libraries and 
IDE support, including debuggers also play an important role.



--
Paulo


Re: why does DMD compile hello world to about 500 _kilobytes_ on Mac OS X [x86_64]?!?

2014-09-06 Thread Paulo Pinto via Digitalmars-d

Am 06.09.2014 02:03, schrieb Ary Borenszweig:

On 8/31/14, 8:51 PM, Abe wrote:

Please note: 502064 bytes!!!  [for the curious: 490.296875
kilobytes]


The real question is: why does size matter for you?

A simple hello world program in Go is 2 megabytes. That's four times
the size in D. I don't know if people complain about that.

I efficiency matters most.


Well, the Go guys are now trying to minimize the footprint of static 
compilation.


The many places 2 MB is a lot.

--
Paulo


Fun with inout

2014-09-06 Thread Manu via Digitalmars-d
I'm having a lot of problems with meta when inout gets involved.
There's no std.traits that deal with inout, and I think that's a bit of a
hole...

So my situation is, I have X captured by ReturnType!(T.f), and I also have
T.
T.f is inout(RT)[] f() inout { return ...; }

I run into the situation where X == inout(RT)[]. I can't declare variables
of that type, and it all goes wrong.
What I need to do, is transform X into RT[], const(RT)[] or immutable(RT)[]
accordingly to T.

First problem, I can't work out how to detect if X is inout, I can't seem
to craft an is() expression that works, and there's nothing in std.traits.
After that, I need to perform the substitution, and that's proving to be
really tricky...

I think a std template could be created which will transform some type
containing inout with the appropriate mutability level taken from some
other type...

Can anyone suggest how I might write that template? I can't work it out _


Re: [OT] If programming languages were weapons

2014-09-06 Thread monarch_dodra via Digitalmars-d

On Saturday, 6 September 2014 at 02:51:53 UTC, Meta wrote:
On Tuesday, 2 September 2014 at 21:45:42 UTC, Brian Schott 
wrote:
On Tuesday, 2 September 2014 at 08:29:25 UTC, Iain Buclaw 
wrote:

In normal fashion, it's missing an entry for D.

http://bjorn.tipling.com/if-programming-languages-were-weapons

I'll let your imaginations do the work.


Iain.


https://www.youtube.com/watch?feature=player_detailpagev=4M-0LFBP9AU#t=3670

http://imgur.com/BAiJKUS


Not quite accurate. D is a samurai sword with a machine-gun 
attached that also has one of these bad boys on the other end:


http://www.wimp.com/militaryshovel/

The problem is that it's many tools in one, some of which don't 
work as well as they could together, and make it a complicated 
tool to master (but extremely versatile when you do). It comes 
with an instruction manual that tells you the function of each 
different piece, but not how different pieces can be used 
together to make things easier.


I'd say it's a prototype laser blaster that has been proven to 
work. However, it isn't quite ready for mass deployment amongst 
the troops, or acceptance with the brass.


Re: CDGC porting: is someone still working on it?

2014-09-06 Thread Jacob Carlborg via Digitalmars-d

On 2014-09-05 20:20, Dicebot wrote:


Unfortunately I have had to pause it a bit


Is it due to the garbage collector running :)

--
/Jacob Carlborg


Re: kill the commas! (phobos code cleanup)

2014-09-06 Thread Marco Leise via Digitalmars-d
Am Thu, 4 Sep 2014 00:55:47 +0300
schrieb ketmar via Digitalmars-d digitalmars-d@puremagic.com:

 On Wed, 03 Sep 2014 21:38:55 +
 via Digitalmars-d digitalmars-d@puremagic.com wrote:
 
  That sucks! Now I had to do it myself. (I think you should 
  upgrade to a decent editor on a decent OS and save me some 
  unicode-work…;)
 no-no-no-no! utf of any size is boring. i want my strings to be
 indexable without any hidden function calls! ;-)
 
 i even did native-encoded strings patch (nhello!) and made lexer
 don't complain about bad utf in comments. i love my one-byte locale!

But there lies greatness in the unification of all locales
into just one. All the need for encodings in HTTP that more
often than not were incorrectly declared making browsers guess.
Text files that looked like gibberish because they came from
DOS or were written in another language that you even happen to
speak, but now cannot decypher the byte mess. Or do you
remember the mess that happened to file names with accented
characters if they were sufficiently often copied between file
systems?
I'm all for performance, but different encodings on each
computing platform and language just didn't work in the
globalized world. You are a relic :)

-- 
Marco


signature.asc
Description: PGP signature


Re: Automated source translation of C++ to D

2014-09-06 Thread Marco Leise via Digitalmars-d
Am Thu, 21 Aug 2014 17:57:11 +
schrieb Joakim dl...@joakim.airpost.net:

 On Thursday, 21 August 2014 at 10:00:43 UTC, Daniel Murphy wrote:
 
  You might want to look at DDMD, which is automatically 
  converted.
 
 Yes, I'm aware of ddmd.  You've mentioned many times that it only 
 works because dmd is written using a very unC++-like style, to 
 the point where github's source analyzer claims that dmd is 
 written in 66.7% C, 28.4% D (presumably the tests right now), 
 4.4% C++, and 0.5% other. :)

OT: That's because the analyzer analyzes the file name part
after the last . and dmd uses an atypical extension for C++.

-- 
Marco



Re: What criteria do you take

2014-09-06 Thread Dominikus Dittes Scherkl via Digitalmars-d
On Saturday, 6 September 2014 at 02:30:50 UTC, Cassio Butrico 
wrote:
What criteria do you take into consideration for the choice of 
a programming language.
and why? does not mention what language would be, but what 
criteria led them to choose.


First of all I want efficient generated code: fast and small.
Then I love also very small source code, so expressiveness 
matters too.


Re: kill the commas! (phobos code cleanup)

2014-09-06 Thread ketmar via Digitalmars-d
On Sat, 6 Sep 2014 11:48:53 +0200
Marco Leise via Digitalmars-d digitalmars-d@puremagic.com wrote:

 You are a relic :)
sure i am! ;-)
i'm just waiting for 32-bit bytes. and white bytes are 8-bit, i'll use
ebcdic^w one of available one-byte encodings. ;-)

btw: are there fonts that can display all unicode? i doubt it (ok, may
be one). so we designed the thing that can't really use. ;-)


signature.asc
Description: PGP signature


Re: What criteria do you take

2014-09-06 Thread ketmar via Digitalmars-d
On Sat, 06 Sep 2014 02:30:49 +
Cassio Butrico via Digitalmars-d digitalmars-d@puremagic.com wrote:

 What criteria do you take into consideration for the choice of a 
 programming language.
 and why? does not mention what language would be, but what 
 criteria led them to choose.
fun factor. it *absolutely* *must* be fun to write in this language.
Scheme is fun. Smalltalk is fun. D is fun. C is boring. C++ is
disgusting. python is ugly. java is just trash. and so on.


signature.asc
Description: PGP signature


Re: Fun with inout

2014-09-06 Thread Kagamin via Digitalmars-d

template ReturnType1(alias F, TArg)
{
alias ReturnType1=typeof((){
ReturnType!F function(inout Unqual!TArg) test;
TArg testv;
return test(testv);
}());
}


Re: What criteria do you take

2014-09-06 Thread monarch_dodra via Digitalmars-d
On Saturday, 6 September 2014 at 02:30:50 UTC, Cassio Butrico 
wrote:
What criteria do you take into consideration for the choice of 
a programming language.
and why? does not mention what language would be, but what 
criteria led them to choose.


In the words of Marshall Cline, programming language selection 
is dominated by business considerations, not by technical 
considerations.

http://earth.uni-muenster.de/~joergs/doc/cppfaq/big-picture.html#[6.4]

So I'd just chose whatever I *know* that I *could* use to solve a 
problem. If it works perfect.


Re: kill the commas! (phobos code cleanup)

2014-09-06 Thread monarch_dodra via Digitalmars-d
On Saturday, 6 September 2014 at 10:20:23 UTC, ketmar via 
Digitalmars-d wrote:

On Sat, 6 Sep 2014 11:48:53 +0200
Marco Leise via Digitalmars-d digitalmars-d@puremagic.com 
wrote:



You are a relic :)

sure i am! ;-)
i'm just waiting for 32-bit bytes. and white bytes are 8-bit, 
i'll use

ebcdic^w one of available one-byte encodings. ;-)


That sounds so much better than UTF-32.


btw: are there fonts that can display all unicode?
i doubt it (ok, maybe one).


Fonts are encoding agnostic, your point is irrelevant.


 so we designed the thing that can't really use. ;-)


We can and do: unicode is the only thing that could process text 
that could come from any client on earth, without choking on any 
character. This is all done without the need for font-display, 
which is on the burden of the final client, and their respective 
local needs.


Re: What criteria do you take

2014-09-06 Thread Kagamin via Digitalmars-d

If nothing imposes additional restrictions
1. efficient
2. C family
3. safer than C
4. nicer than C++


Re: What criteria do you take

2014-09-06 Thread Kagamin via Digitalmars-d

Hehe, or like this:
1. C family
2. more efficient than Java/C#, like C/C++
3. safer and nicer than C/C++, like Java/C#


Re: Fun with inout

2014-09-06 Thread Manu via Digitalmars-d
Interesting. You're attacking it from the ReturnType! angle... I didn't
think of that.

I had to stare at this for like 10 minutes to work out how it works ;)
I think I can use this, but I'm not sure it addresses the hole in phobos?


On 6 September 2014 21:00, Kagamin via Digitalmars-d 
digitalmars-d@puremagic.com wrote:

 template ReturnType1(alias F, TArg)
 {
 alias ReturnType1=typeof((){
 ReturnType!F function(inout Unqual!TArg) test;
 TArg testv;
 return test(testv);
 }());
 }



Re: kill the commas! (phobos code cleanup)

2014-09-06 Thread ketmar via Digitalmars-d
On Sat, 06 Sep 2014 11:05:13 +
monarch_dodra via Digitalmars-d digitalmars-d@puremagic.com wrote:

 That sounds so much better than UTF-32.
why, in the name of hell, do you need UTF-32?! doesn't
0x1 chars enough for everyone?!

  btw: are there fonts that can display all unicode?
  i doubt it (ok, maybe one).
 Fonts are encoding agnostic, your point is irrelevant.
so where can i download font collection with fonts contains all unicode
chars?

 This is all done without the need for font-display
thank you, but i don't need any text i can't display (and therefore
read). i bet you don't need to process Thai, for example -- 'cause this
requires much more than just character encoding convention. and bytes
are encoding-agnostic.

 which is on the burden of the final client, and their respective 
 local needs.
hm... text processing software developed on systems which can't display
processing text? wow! i want two!


signature.asc
Description: PGP signature


Re: What criteria do you take

2014-09-06 Thread via Digitalmars-d
On Saturday, 6 September 2014 at 02:30:50 UTC, Cassio Butrico 
wrote:
What criteria do you take into consideration for the choice of 
a programming language.


1. Platform support, language stability and solid backing.

Compiled imperative programming languages are more or less alike, 
so platform support is usually the criterion that affects 
selection most and closely related to stability (of all kinds).


2. Learnability. Comprehensible structure of libraries.

Learning a new imperative language is typically done in a week or 
less. It is learning the libraries that takes most time, so I 
prefer languages that use standard structuring of core libraries 
(less to learn).


3. Expressiveness and rapid evolutionary development. Basically 
cheaper development.


4. Type-safety.

5. Predictable performance and portability. 
C/C++/shader-languages supports this well.


6. Transparency.

I want to understand what goes on in the runtime. C supports this 
very well. Big frameworks does not. I avoid big frameworks if 
possible since I they tend to imply limitations that are hard to 
work around.


Quick evalution of D:

1. D lacks platform support, language stability and backing. I 
don't plan on using D for paid projects until I understand the 
compiler internals so well that I know that I can fix it myself.


2. D is fairly easy to learn, except for quirks. Libraries could 
be more comprehensible, but I don't depend on them since D 
interfaces with C/C++.


3. D has decent expressiveness. Better for rapid development than 
C/C++, but Python does better.


4. D has acceptable type safety, but could do better at compile 
time correctness.


5. I think the C world overall does better at performance and 
portability at the moment.


6. The D runtime structure is too big for my liking, and not very 
transparent, but if you go to the trouble of modifying the 
compiler anyway it is not all that bad.





Re: Fun with inout

2014-09-06 Thread Kagamin via Digitalmars-d

You can write it inline, it's about 2 lines

ReturnType!(T.f) function(inout Unqual!T) test;
typeof(test(t))... // if you have t of type T


Re: Fun with inout

2014-09-06 Thread Kagamin via Digitalmars-d
On Saturday, 6 September 2014 at 11:46:17 UTC, Manu via 
Digitalmars-d wrote:
Interesting. You're attacking it from the ReturnType! angle... 
I didn't

think of that.


Function may not have `this` parameter, then you will need to 
specify argument type anyway.


Re: kill the commas! (phobos code cleanup)

2014-09-06 Thread Marco Leise via Digitalmars-d
Am Sat, 6 Sep 2014 14:52:19 +0300
schrieb ketmar via Digitalmars-d digitalmars-d@puremagic.com:

 On Sat, 06 Sep 2014 11:05:13 +
 monarch_dodra via Digitalmars-d digitalmars-d@puremagic.com wrote:
 
  That sounds so much better than UTF-32.
 why, in the name of hell, do you need UTF-32?! doesn't
 0x1 chars enough for everyone?!
 
   btw: are there fonts that can display all unicode?
   i doubt it (ok, maybe one).
  Fonts are encoding agnostic, your point is irrelevant.
 so where can i download font collection with fonts contains all unicode
 chars?
 
  This is all done without the need for font-display
 thank you, but i don't need any text i can't display (and therefore
 read). i bet you don't need to process Thai, for example -- 'cause this
 requires much more than just character encoding convention. and bytes
 are encoding-agnostic.
 
  which is on the burden of the final client, and their respective 
  local needs.
 hm... text processing software developed on systems which can't display
 processing text? wow! i want two!

Dude! This is handled the same way sound fonts for Midi did
it. You can mix and match fonts to create the complete
experience. If your version of Arial doesn't come with
Thai symbols, you just install _any_ Asian font which includes
those and it will automatically be used in places where your
favorite font lacks symbols. Read this Wikipedia article from
2005 on it: http://en.wikipedia.org/wiki/Fallback_font
In practice it is a solved problem, as you can see in your
browser when you load a web site with mixed writing systems.

If all else fails, there is usually something like this in
place:
http://scripts.sil.org/cms/scripts/page.php?site_id=nrsiid=UnicodeBMPFallbackFont
E.g. Missing symbols are replaced by a square with the
hexadecimal code point. So the missing symbol can at least be
identified correctly (and a matching font installed).

-- 
Marco


signature.asc
Description: PGP signature


Re: kill the commas! (phobos code cleanup)

2014-09-06 Thread ketmar via Digitalmars-d
On Sat, 6 Sep 2014 14:52:50 +0200
Marco Leise via Digitalmars-d digitalmars-d@puremagic.com wrote:

 In practice it is a solved problem, as you can see in your
 browser when you load a web site with mixed writing systems.
and hurts my eyes. i have a little background in typography, and mixing
different fonts makes my eyes bleed.

 E.g. Missing symbols are replaced by a square with the
 hexadecimal code point. So the missing symbol can at least be
 identified correctly (and a matching font installed).
this can't help me reading texts. really, i'm not a computer, i don't
remember which unicode number corresponds to which symbol.


signature.asc
Description: PGP signature


Re: What criteria do you take

2014-09-06 Thread Marco Leise via Digitalmars-d
Am Sat, 06 Sep 2014 02:30:49 +
schrieb Cassio Butrico cassio_butr...@ig.com.br:

 What criteria do you take into consideration for the choice of a 
 programming language.
 and why? does not mention what language would be, but what 
 criteria led them to choose.

In a start-up:

- known and been used by many developers
- low potential of running into unsolved issues
- rich eco-system with a potential solution for anything I
  planned
- lots of free/open source solutions to get started without a
  big investment first
- works as well for programmers on Windows/Linux/OS X
- minimizes internal bike-shedding

In other words Java. :)
The only bike-shedding I ever had was weather we should write
getID or getId. One says ID is the correct abbreviation of
identification, the other says the field's name is id and
camel case rules dictate getId.



Personally it just comes down fun to work with and my bias
towards maximum efficiency and static checking through the
compiler. D ranks very high here.

+ templates, CTFE and UDAs are fun to work with; it is easy to
  do meta-programming with these tools
+ if needed also works as a better-C
+ can use efficient C libraries without conversion layer
+ dynamic linking allows for small native executables and
  memory reuse of already loaded read-only segments of
  phobos2.so.
+ lots of static checking and template constraints
+ removes friction between systems by defining long as 64-bit
  and character arrays to be in Unicode encoding

- incompatible ABI between compiler vendors requires 3
  installations of the same lib to do testing with each
- inline ASM syntax also diverges between vendors
- GC implementation and efficiency issues
- being flexible, safe and efficient at the same time is
  sometimes a liability; e.g. File.byLine buffer reuse issue,
  Java taking the freedom to offer inefficient operations on
  all containers to keep them interchangeable.

Before D I used Delphi. It is IMHO the best programming
environment for efficient, native GUI applications on Windows.
It comes with integrated compiler, linker, debugger and that
sort of stuff and the GUI designer is integral part of the
IDE. Most other GUI designers feel like or are an external
tool with no interaction with the code editor.

-- 
Marco



Re: kill the commas! (phobos code cleanup)

2014-09-06 Thread Marco Leise via Digitalmars-d
Am Sat, 6 Sep 2014 15:52:09 +0300
schrieb ketmar via Digitalmars-d digitalmars-d@puremagic.com:

 On Sat, 6 Sep 2014 14:52:50 +0200
 Marco Leise via Digitalmars-d digitalmars-d@puremagic.com wrote:
 
  In practice it is a solved problem, as you can see in your
  browser when you load a web site with mixed writing systems.
 and hurts my eyes. i have a little background in typography, and mixing
 different fonts makes my eyes bleed.

Japanese and Latin are already so far apart that the font
doesn't make much of a difference anymore, so long as it has
similar size and hinting options. As for mixing writing
systems there are of course dozens of use cases. Presenting an
English website with links to localized versions labeled with
each language's name, programs dealing with
mathematical/technical symbols can use regular text allowing
for easy copypaste, instead of resorting to bitmaps, e.g.
for logical OR or Greek variables. And to make your eyes
bleed even more here is a Cyrillic Wikipedia article on Mao
Tse-Tung, using traditional and simplified versions of his
name in Chinese and the two transliterations to Latin according
to Pinyin and Wade-Giles:
https://ru.wikipedia.org/wiki/Мао_Цзэдун

  E.g. Missing symbols are replaced by a square with the
  hexadecimal code point. So the missing symbol can at least be
  identified correctly (and a matching font installed).
 this can't help me reading texts. really, i'm not a computer, i don't
 remember which unicode number corresponds to which symbol.

Yes, but why do you prefer garbled symbols incorrectly mapped
to your native encoding or even invalid characters silently
removed ?
Do you understand that with the symbols displayed as code
points you still have all the information even if it doesn't
look readable immediately ?
It offers you new options:
* You can copy and paste the text into an online translator to
  get an idea of what the text says.
* You can enter the code into a tool that tells you which
  script it is from and then look for a font that contains
  that script to get an acceptable display.

-- 
Marco


signature.asc
Description: PGP signature


Re: kill the commas! (phobos code cleanup)

2014-09-06 Thread Idan Arye via Digitalmars-d
On Saturday, 6 September 2014 at 12:52:19 UTC, ketmar via 
Digitalmars-d wrote:

On Sat, 6 Sep 2014 14:52:50 +0200
Marco Leise via Digitalmars-d digitalmars-d@puremagic.com 
wrote:

E.g. Missing symbols are replaced by a square with the
hexadecimal code point. So the missing symbol can at least be
identified correctly (and a matching font installed).
this can't help me reading texts. really, i'm not a computer, i 
don't

remember which unicode number corresponds to which symbol.


Does it really matter? I don't really care if some UTF8 encoded 
text can't be displayed properly because it's written in some 
Ancient Mayan language and I don't have the right font installed. 
Even if I did install that font and manage to get it to display 
correctly - I can't read that language!



Learning a language is much harder than installing a font, so 
it's a pretty safe assumption that if you can read that language 
you can install the font for it...


Re: kill the commas! (phobos code cleanup)

2014-09-06 Thread ketmar via Digitalmars-d
On Sat, 6 Sep 2014 16:38:50 +0200
Marco Leise via Digitalmars-d digitalmars-d@puremagic.com wrote:

 Yes, but why do you prefer garbled symbols incorrectly mapped
 to your native encoding or even invalid characters silently
 removed ?
i prefer to not read the text i cannot understand. there is zero
information in Chinese, or Thai, or even Spanish for me. those texts
looks (for me) like gibberish anyway. so i don't care if they are
displayed correctly or not. that's why i using one-byte encoding and
happy with it.

 Do you understand that with the symbols displayed as code
 points you still have all the information even if it doesn't
 look readable immediately ?
no, i don't understand this. for me Chinese glyph and abstract painting
is the same. and simple box, for that matter.

 It offers you new options:
only one: trying to paste URL to google translate and then trying to
make sense from GT output. and i don't care what encoding was used for
page in this case.


signature.asc
Description: PGP signature


Re: What criteria do you take

2014-09-06 Thread Paulo Pinto via Digitalmars-d

Am 06.09.2014 15:54, schrieb Marco Leise:

Am Sat, 06 Sep 2014 02:30:49 +
schrieb Cassio Butrico cassio_butr...@ig.com.br:

...

Before D I used Delphi. It is IMHO the best programming
environment for efficient, native GUI applications on Windows.
It comes with integrated compiler, linker, debugger and that
sort of stuff and the GUI designer is integral part of the
IDE. Most other GUI designers feel like or are an external
tool with no interaction with the code editor.



It was great! Pity Borland had to mess it up.

Now C#/.NET Native is the closest experience to it.

--
Paulo


Re: Fun with inout

2014-09-06 Thread Manu via Digitalmars-d
It'd be preferable to receive a type, rather than a function alias.


On 6 September 2014 22:21, Kagamin via Digitalmars-d 
digitalmars-d@puremagic.com wrote:

 On Saturday, 6 September 2014 at 11:46:17 UTC, Manu via Digitalmars-d
 wrote:

 Interesting. You're attacking it from the ReturnType! angle... I didn't
 think of that.


 Function may not have `this` parameter, then you will need to specify
 argument type anyway.



rpath options to linkers, OSX issue

2014-09-06 Thread Russel Winder via Digitalmars-d
Ariovistus originally reported Issue 2940 against SCons and the D
toolset (http://scons.tigris.org/issues/show_bug.cgi?id=2940). The gdc
tool uses -Wl,-rpath=. in the gdc command to set the rpath for gdc.
The dmd tool uses -L-rpath=. in the dmd command to set the rpath for
dmd.

This all works fine on Linux. I haven't managed to find a way to test
this on Windows.

It seems for the first time (which surprised me as I thought I had
checked this), I am running the tests on OSX and -L-rpath=. generates
-rpath=. to the ld which is Clang and it rejects this option.

I am assuming the problem is in my OSX set up and not in what dmd is
doing. I get dmd via MacPorts, it is v2.066-devel.

Is there an OSX user out there having no problem with dmd and dynamic
libraries I can prevail upon to give me a hand with this? 

-- 
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: Fun with inout

2014-09-06 Thread Kagamin via Digitalmars-d
Hmm... extract type from function with desired constancy and pass 
it where you expect a ready to use type.


Re: Fun with inout

2014-09-06 Thread Manu via Digitalmars-d
Existing code is using ReturnType though, so it'd be handy to be able to
perform this same resolution on a type that I already have...


On 7 September 2014 02:25, Kagamin via Digitalmars-d 
digitalmars-d@puremagic.com wrote:

 Hmm... extract type from function with desired constancy and pass it where
 you expect a ready to use type.



Re: Mono corrupted D files

2014-09-06 Thread Dicebot via Digitalmars-d

On Saturday, 6 September 2014 at 02:03:00 UTC, AsmMan wrote:
Does anyone knows if the Mono for D is active on this forum? or 
even knows how can I contact he? I can't find any email/web 
page...


Probably he knows if there's a way to get back this zero-ed 
files. Get them back by reading from a hex debugger was the 
closest I did so far but as it just show blocks of the file 
(and with repeats and a lot of parts missing) a rewriter is 
probably better.


https://github.com/aBothe/Mono-D


Re: Mono corrupted D files

2014-09-06 Thread Etienne Cimon via Digitalmars-d

On 2014-09-05 21:48, AsmMan wrote:

I was so happy when my search got a result... but these results
are very small blocks of an old version of the files I lost. One
of the files had around 800 lines I can find say, 150/180 lines
using it. Now I know how this called:

http://en.wikipedia.org/wiki/Zero_byte_file


That's still very good, you could also repeat the search for other 
strings from the blocks you lost, they may be in different versions and 
different blocks.


Re: Automated source translation of C++ to D

2014-09-06 Thread Andrej Mitrovic via Digitalmars-d
On 8/21/14, Walter Bright via Digitalmars-d digitalmars-d@puremagic.com wrote:
 The trouble is, D is not a perfect superset of C++, not even close

I don't think that's important for porting. To quote:

-
Engineering teams at Mozilla and Epic ported the award-winning Unreal
Engine 3 (UE3) to the Web in just four days using the powerful
combination of asm.js and Emscripten, which enables developers to
compile C++ code into JavaScript.[1]
-

[1] : 
https://www.unrealengine.com/news/epic-games-releases-epic-citadel-on-the-web

I'm still amazed that this is even possible. But it makes me think
what does JS have over D that makes this possible? I have a feeling
it's only down to the number and capability of people working on such
a project which guarantees it's success (JS is important, and the
Unreal Engine is important).


Re: Some notes on performance

2014-09-06 Thread Marco Leise via Digitalmars-d
Am Tue, 02 Sep 2014 10:23:57 +
schrieb po y...@no.com:

   The first link says that Chrome is a *90* meg binary!  Gawd 
 damn. Either they write some really bloated code, or modern 
 browsers require way too much shit to function.

Hmm, my installation of Lynx is 1.6 MiB in size. But
gfx and HTML 5 are kind of non-existent.

-- 
Marco



Re: Automated source translation of C++ to D

2014-09-06 Thread ketmar via Digitalmars-d
On Sat, 6 Sep 2014 20:42:32 +0200
Andrej Mitrovic via Digitalmars-d digitalmars-d@puremagic.com wrote:

there is two kinds of porting.

first is just generation of code that will be compiled by the target
compiler. this code can be messy, unreadable and unmaintainable, nobody
cares until it compiles.

second is real porting, when code is still human-readable and easy to
support, just written in another language.

it's not that hard, for example, to wrtite C++ - D translator that
produces working mess. let C++ compiler to instantiate all
necessary templates and so on, then use D as high-level assembler.
resulting blob will be unmaintainable, but working. but this has no
sense, 'cause without original C++ code resulting D code cannot be
supported by any sane human person.

UE porting is of second kind.


signature.asc
Description: PGP signature


Re: Mono corrupted D files

2014-09-06 Thread Kapps via Digitalmars-d

On Wednesday, 3 September 2014 at 21:13:31 UTC, AsmMan wrote:
Something very strange happened 2/3 days ago. Two of my D files 
of the project I was working on got all values replaced by 0 
(that's what I seen rather D code if I open the file with a hex 
debugger). The file size of both files keep intact although. 
And no, I have no backup of these files. I had a old copy of it 
on a external hard drive but I needed to format it to use in 
something else and didn't put my files before it...


Instead of turn off my windows machine I always hirbenate it 
and left open all stuff and then I just back quickly to point 
where I was on. That day, when I logged on system I noticied 
first non-usual behavior: the machine looked like I had 
restarted it instead of hibernate. All stuff I left open 
(including mono) wasn't open anymore. I find it strage but 
moved on. But to my surprise when I open mono, the recent 
projects always available on left menu bar was empty. Just 
like I had installed mono not used yet. I open my project 
directly by clicking on open and navigating to folder of 
projec and then I see the two of main project files with a 
values set to zero.


Can some Mono expected help me?
My question is: can I recovery these files? or what remains to 
me is cry?
restore the system didn't helped (and I neither expected to but 
I tried)


Not sure if it is related: that day my machine had no a network 
connection.


Sounds like something crashed during the middle of a write. I 
would be surprised if this was related to Mono-D at all (I highly 
doubt that he changed the way files are saved). I'd also be 
concerned about the potential of a dying HDD, though that's less 
likely if this is the only thing that broke.


Re: Voting: std.logger

2014-09-06 Thread Kevin Lamonte via Digitalmars-d
On Wednesday, 3 September 2014 at 13:13:31 UTC, Ola Fosheim 
Grøstad wrote:


If you accept slightly out of sync logging then you can have 
thread local buffers and on x86 use the command RDTSC which 
gives you a (good enough) timer value so you can merge the 
buffers from threads later. It takes roughly 20-30 cycles which 
I presume is better than CAS instructions, or you can just 
write directly to a global counter without CAS and accept that 
it jitters?


Since we are talking about performance, I did some tests and 
found to my surprise that ~95% of the time consumed in a log call 
is Clock.currTime's call to clock_gettime().  I submitted a 
report for it (https://issues.dlang.org/show_bug.cgi?id=13433), 
but it also brings up how to expose it in the std.logger API.


The API automatically grabs thisTid and Clock.currTime during 
construction of the LogEntry (plus it should also grab 
Thread.getThis and Fiber.getThis).  Should this behavior be 
modifiable by clients, by subclasses, or neither?  If so, how?


Re: Automated source translation of C++ to D

2014-09-06 Thread Walter Bright via Digitalmars-d

On 9/6/2014 11:42 AM, Andrej Mitrovic via Digitalmars-d wrote:

On 8/21/14, Walter Bright via Digitalmars-d digitalmars-d@puremagic.com wrote:

The trouble is, D is not a perfect superset of C++, not even close


I don't think that's important for porting. To quote:

-
Engineering teams at Mozilla and Epic ported the award-winning Unreal
Engine 3 (UE3) to the Web in just four days using the powerful
combination of asm.js and Emscripten, which enables developers to
compile C++ code into JavaScript.[1]
-

[1] : 
https://www.unrealengine.com/news/epic-games-releases-epic-citadel-on-the-web

I'm still amazed that this is even possible. But it makes me think
what does JS have over D that makes this possible? I have a feeling
it's only down to the number and capability of people working on such
a project which guarantees it's success (JS is important, and the
Unreal Engine is important).



I'd have to see the source code and the translated code to form any judgement 
about that.


Re: Voting: std.logger

2014-09-06 Thread via Digitalmars-d
On Saturday, 6 September 2014 at 19:41:54 UTC, Kevin Lamonte 
wrote:
The API automatically grabs thisTid and Clock.currTime during 
construction of the LogEntry (plus it should also grab 
Thread.getThis and Fiber.getThis).  Should this behavior be 
modifiable by clients, by subclasses, or neither?  If so, how?


I think maybe we should start with creating a high performance 
inlined (for ldc/gdc) in-memory multi-threaded binary reference 
logger and then extend the interface in ways that does not make 
it noticeably slower using the reference logger as the baseline. 
(Noticeably  100%?)


When logging to an external logging service you might want the 
logging service do the time-keeping so you don't get merged logs 
from multiple servers that are out of sync. In that case 
collecting absolute time locally is kinda pointless (although you 
might want to submit serial numbers and relative time between 
logging events from the same server).


Re: Automated source translation of C++ to D

2014-09-06 Thread via Digitalmars-d
On Saturday, 6 September 2014 at 20:06:51 UTC, Walter Bright 
wrote:
I'd have to see the source code and the translated code to form 
any judgement about that.


AFAIK Emscripten is not a source-to-source translator. It is a 
LLVM backend. asm2js code is very cryptic. You basically have 
everything in one big array and weird javascript expressions that 
are meant to ensure that expressions are taken as typed by the 
JIT. You cannot reasonably expect to be able to modify the output 
by hand.


Re: Automated source translation of C++ to D

2014-09-06 Thread deadalnix via Digitalmars-d
On Saturday, 6 September 2014 at 18:42:43 UTC, Andrej Mitrovic 
via Digitalmars-d wrote:
On 8/21/14, Walter Bright via Digitalmars-d 
digitalmars-d@puremagic.com wrote:
The trouble is, D is not a perfect superset of C++, not even 
close


I don't think that's important for porting. To quote:

-
Engineering teams at Mozilla and Epic ported the award-winning 
Unreal

Engine 3 (UE3) to the Web in just four days using the powerful
combination of asm.js and Emscripten, which enables developers 
to

compile C++ code into JavaScript.[1]
-

[1] : 
https://www.unrealengine.com/news/epic-games-releases-epic-citadel-on-the-web


I'm still amazed that this is even possible. But it makes me 
think
what does JS have over D that makes this possible? I have a 
feeling
it's only down to the number and capability of people working 
on such
a project which guarantees it's success (JS is important, and 
the

Unreal Engine is important).


asm.js is NOT javascript.

asm.js is a bytecode format for native code, and a very 
inefficient one for that matter, as it uses the same syntax as 
javascript.


One of the said advantage of this format, is that it is 
retro-compatible with javascript. That mean that the bytecode can 
be interpreted as javascript and still works.


For some values of works.

Indeed, run as javascript, asm.js is an order of magnitude 
slower. You can consider that compatible for toy program, but the 
reason to use asm.js to begin with is performance, and so an 
order of magnitude slower is not acceptable.


For the example of unity, that means unplayable games.

Once you understand that this retro-compatibility with javascript 
argument is bullshit, it is easily understood that asm.js is 
simply a variant of pNaCl, that uses bloated bytecode to provide 
extra useless features and create fragmentation.


Brendan Eich being CTO of mozilla when they dropped pNaCl in 
favor of asm.js is probably relevant.


Re: What criteria do you take

2014-09-06 Thread Cassio Butrico via Digitalmars-d

On Saturday, 6 September 2014 at 15:03:12 UTC, Paulo Pinto wrote:

Am 06.09.2014 15:54, schrieb Marco Leise:

Am Sat, 06 Sep 2014 02:30:49 +
schrieb Cassio Butrico cassio_butr...@ig.com.br:

...

Before D I used Delphi. It is IMHO the best programming
environment for efficient, native GUI applications on Windows.
It comes with integrated compiler, linker, debugger and that
sort of stuff and the GUI designer is integral part of the
IDE. Most other GUI designers feel like or are an external
tool with no interaction with the code editor.



It was great! Pity Borland had to mess it up.

Now C#/.NET Native is the closest experience to it.

--
Paulo
Thank you all, the reason for the question and what we can do for 
programmers that will program in D.

Thank you again.


Re: kill the commas! (phobos code cleanup)

2014-09-06 Thread Marco Leise via Digitalmars-d
Am Sat, 6 Sep 2014 17:51:23 +0300
schrieb ketmar via Digitalmars-d digitalmars-d@puremagic.com:

 On Sat, 6 Sep 2014 16:38:50 +0200
 Marco Leise via Digitalmars-d digitalmars-d@puremagic.com wrote:
 
  Yes, but why do you prefer garbled symbols incorrectly mapped
  to your native encoding or even invalid characters silently
  removed ?
 i prefer to not read the text i cannot understand. there is zero
 information in Chinese, or Thai, or even Spanish for me. those texts
 looks (for me) like gibberish anyway. so i don't care if they are
 displayed correctly or not. that's why i using one-byte encoding and
 happy with it.
 
  Do you understand that with the symbols displayed as code
  points you still have all the information even if it doesn't
  look readable immediately ?
 no, i don't understand this. for me Chinese glyph and abstract painting
 is the same. and simple box, for that matter.
 
  It offers you new options:
 only one: trying to paste URL to google translate and then trying to
 make sense from GT output. and i don't care what encoding was used for
 page in this case.

So because you see no use for Unicode (which is hard to
believe considering all the places where localized strings
may be used), everyone has to keep supporting hacks to guess
text encodings or NFC normalize and convert strings to the
system locale that go to the terminal. Thanks for the extra
work :p

-- 
Marco


signature.asc
Description: PGP signature


Re: What criteria do you take

2014-09-06 Thread Cassio Butrico via Digitalmars-d
On Saturday, 6 September 2014 at 22:16:02 UTC, Cassio Butrico 
wrote:
On Saturday, 6 September 2014 at 15:03:12 UTC, Paulo Pinto 
wrote:

Am 06.09.2014 15:54, schrieb Marco Leise:

Am Sat, 06 Sep 2014 02:30:49 +
schrieb Cassio Butrico cassio_butr...@ig.com.br:

...

Before D I used Delphi. It is IMHO the best programming
environment for efficient, native GUI applications on Windows.
It comes with integrated compiler, linker, debugger and that
sort of stuff and the GUI designer is integral part of the
IDE. Most other GUI designers feel like or are an external
tool with no interaction with the code editor.



It was great! Pity Borland had to mess it up.

Now C#/.NET Native is the closest experience to it.

--
Paulo
Thank you all, the reason for the question and what we can do 
for programmers that will program in D.

Thank you again.
If I can start over again, thousands of miles away, I will have 
in mind, I would program in D.


Re: What criteria do you take

2014-09-06 Thread Nick Sabalausky via Digitalmars-d

On 9/6/2014 9:07 PM, Cassio Butrico wrote:

On Saturday, 6 September 2014 at 22:16:02 UTC, Cassio Butrico wrote:

Thank you all, the reason for the question and what we can do for
programmers that will program in D.
Thank you again.

If I can start over again, thousands of miles away, I will have in mind,
I would program in D.


Heh, who knew Reznor was a D fan? :)



Re: Mono corrupted D files

2014-09-06 Thread AsmMan via Digitalmars-d
On Saturday, 6 September 2014 at 17:51:50 UTC, Etienne Cimon 
wrote:

On 2014-09-05 21:48, AsmMan wrote:

I was so happy when my search got a result... but these results
are very small blocks of an old version of the files I lost. 
One

of the files had around 800 lines I can find say, 150/180 lines
using it. Now I know how this called:

http://en.wikipedia.org/wiki/Zero_byte_file


That's still very good, you could also repeat the search for 
other strings from the blocks you lost, they may be in 
different versions and different blocks.


I gave up to recovery them. No idea why but it does show only old 
versions of the file instead of the most recent. And they are 
small blocks which aren't more than 20% of the file starting from 
line 1. I can't find any part of these 80% in nowhere (I read and 
compared all results).
I got in touch to Mono for D's author and there is no such an 
auto backup on Mono/Xamarim. He recommended another undelete tool 
which didn't worked for me too.  This time I'll do more than one 
backup and active the windows' native one.


Big thanks for everyone which tried to help me.

I'm already reinstalling XS (btw, I asked for windows for desktop 
version and now I'm installing all platforms supported by xamarim 
stuido which I'm not going to develop to).




Re: Mono corrupted D files

2014-09-06 Thread AsmMan via Digitalmars-d

On Saturday, 6 September 2014 at 19:09:30 UTC, Kapps wrote:

On Wednesday, 3 September 2014 at 21:13:31 UTC, AsmMan wrote:
Something very strange happened 2/3 days ago. Two of my D 
files of the project I was working on got all values replaced 
by 0 (that's what I seen rather D code if I open the file with 
a hex debugger). The file size of both files keep intact 
although. And no, I have no backup of these files. I had a old 
copy of it on a external hard drive but I needed to format it 
to use in something else and didn't put my files before it...


Instead of turn off my windows machine I always hirbenate it 
and left open all stuff and then I just back quickly to point 
where I was on. That day, when I logged on system I noticied 
first non-usual behavior: the machine looked like I had 
restarted it instead of hibernate. All stuff I left open 
(including mono) wasn't open anymore. I find it strage but 
moved on. But to my surprise when I open mono, the recent 
projects always available on left menu bar was empty. Just 
like I had installed mono not used yet. I open my project 
directly by clicking on open and navigating to folder of 
projec and then I see the two of main project files with a 
values set to zero.


Can some Mono expected help me?
My question is: can I recovery these files? or what remains to 
me is cry?
restore the system didn't helped (and I neither expected to 
but I tried)


Not sure if it is related: that day my machine had no a 
network connection.


Sounds like something crashed during the middle of a write. I 
would be surprised if this was related to Mono-D at all (I 
highly doubt that he changed the way files are saved). I'd also 
be concerned about the potential of a dying HDD, though that's 
less likely if this is the only thing that broke.



My guess: I had a project opened on mono/xamarim studio where all 
the files has already been saved before I hibernate the computer. 
The computer somehow lost the power xamarim/mono tried to save it 
but computer aborted before making these files into 
zero-byte-file. A zero-byte-file does happen when a program is 
writing to a file but is prematurely aborted because this write 
isn't transfered to file at same time but to a cache instead of 
and at later time written in the file. The computerd turned off 
before it. I think the @Etienne Cimon's method didn't worked well 
because I used the computer after it. Maybe if I had kept the 
computer untouched I could get back them.


Re: Intended behavior of std.range.cycle?

2014-09-06 Thread monarch_dodra via Digitalmars-d-learn

On Friday, 5 September 2014 at 10:41:22 UTC, Vlad Levenfeld wrote:
On Thursday, 4 September 2014 at 11:43:28 UTC, monarch_dodra 
wrote:
*Should* cycle be negatively index-able? Personally, I don't 
think so. And even if it could, it has been proven non-size_t 
indexing is not well supported at all. It was de-facto chosen 
after the iota-map fiasco that all ranges be indexed with 
size_t and nothing else...


Can you elaborate on what the problem was? I'm curious as I've 
recently implemented a DSP module that uses ranges with 
floating-point slicing and, other than having to define a 
second kind of length (I call it measure so I can still have 
a discrete length when I need it), it seems to work well enough 
so far. It'd be bad if there were some unseen fiasco waiting 
for me...


In itself, there is nothing wrong with having a shallow 
container that can be indexed from -inf to +inf. The issues 
might appear if you try to tag on the range interface on it.


In particular, who is front? If I do a foreach over the 
sequence, then will it miss half the elements? What does it mean 
to slice from -5 to +5 ? Which element becomes the new 0?


As for floating point indexing, it's the same thing. The indexing 
itself is fine, there's no problem there. But if you popFront, 
how many elements are you actually skipping over. What would it 
mean if I were to take(4.5) elements?


*Overall*, it should be fine, but if you are creative, you could 
hurt yourself. I don't know your exact use case though.


So my conclusion is mostly that as long as you only index, you 
should be fine. Mix in range adaptors, and things *could* become 
less stable. *could*. But you should still be mostly safe. Again, 
depends on use case.


Installing LDC on Windows

2014-09-06 Thread Russel Winder via Digitalmars-d-learn
OK I installed LDC pre-built on MinGW for Windows on Windows and then
Installed MinGW for Windows but when I run ldc2 it tells me
libgcc_s_dw2-1.dll is missing.

Is this problem soluble by any means other than destruction of Windows?
-- 
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: Installing LDC on Windows

2014-09-06 Thread Danyal Zia via Digitalmars-d-learn
On Saturday, 6 September 2014 at 11:13:20 UTC, Russel Winder via 
Digitalmars-d-learn wrote:
OK I installed LDC pre-built on MinGW for Windows on Windows 
and then

Installed MinGW for Windows but when I run ldc2 it tells me
libgcc_s_dw2-1.dll is missing.

Is this problem soluble by any means other than destruction of 
Windows?


You need to set PATH in environment variables to the directory 
where shared libaries of MinGW are present...


Re: Installing LDC on Windows

2014-09-06 Thread Russel Winder via Digitalmars-d-learn
On Sat, 2014-09-06 at 11:26 +, Danyal Zia via Digitalmars-d-learn
wrote:
 On Saturday, 6 September 2014 at 11:13:20 UTC, Russel Winder via 
 Digitalmars-d-learn wrote:
  OK I installed LDC pre-built on MinGW for Windows on Windows 
  and then
  Installed MinGW for Windows but when I run ldc2 it tells me
  libgcc_s_dw2-1.dll is missing.
 
  Is this problem soluble by any means other than destruction of 
  Windows?
 
 You need to set PATH in environment variables to the directory 
 where shared libaries of MinGW are present...

Hummm… I thought I had since all the DLLs are in the bin directory and
you need that in your PATH. Ah, I installed MinGW that has
libgcc_s_seh-1.dll not libgcc_s_dw2-1.dll.

Of course having a gcc and g++ in my path ruins all my SCons experiments
since the whole point was not to have them in the path, just ldc2. Ho
hum.

-- 
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: Installing LDC on Windows

2014-09-06 Thread Kagamin via Digitalmars-d-learn

SEH was patented, so llvm doesn't support it.


Re: Installing LDC on Windows

2014-09-06 Thread Russel Winder via Digitalmars-d-learn
On Sat, 2014-09-06 at 15:09 +, Kagamin via Digitalmars-d-learn
wrote:
 SEH was patented, so llvm doesn't support it.

I installed the other MinGW option and it provides libgcc_s_sjlj-1.dll
which is not helping me actually run ldc2 on Windows :-(
-- 
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: Installing LDC on Windows

2014-09-06 Thread Kagamin via Digitalmars-d-learn
Looks like mingw supports 3 types of exception handling. LDC 
usually tightly coupled with mingw version, you shouldn't try it 
blindly, but follow installation instructions instead.


Re: Installing LDC on Windows

2014-09-06 Thread Trass3r via Digitalmars-d-learn

SEH was patented, so llvm doesn't support it.


That has changed.


Re: Installing LDC on Windows

2014-09-06 Thread Nick Sabalausky via Digitalmars-d-learn

On 9/6/2014 11:09 AM, Kagamin wrote:

SEH was patented, so llvm doesn't support it.


Seriously, if they're worried about infringing a software patent, they 
have no business writing any code at all. Avoiding things covered by 
patents *and* writing code that actually does anything useful is NOT 
REALISTICALLY POSSIBLE. The SEH patent is just a red herring here.


Re: Installing LDC on Windows

2014-09-06 Thread David Nadlinger via Digitalmars-d-learn

On Saturday, 6 September 2014 at 17:51:16 UTC, Trass3r wrote:

SEH was patented, so llvm doesn't support it.


That has changed.


Has it? SEH on Win64 is something entirely different from the 
original (x86) SEH design, and not covered by said patent.


David


Re: Installing LDC on Windows

2014-09-06 Thread David Nadlinger via Digitalmars-d-learn
On Saturday, 6 September 2014 at 16:11:55 UTC, Russel Winder via 
Digitalmars-d-learn wrote:
I installed the other MinGW option and it provides 
libgcc_s_sjlj-1.dll

which is not helping me actually run ldc2 on Windows :-(


It is mentioned both the in README coming with the Windows 
packages and the on wiki [1] that you need a Dwarf 2 EH package 
(-dw2) of MinGW-w64 for LDC to work.


How can we make this more clear?

Cheers,
David


[1] http://wiki.dlang.org/Building_LDC_on_MinGW_x86


Re: Installing LDC on Windows

2014-09-06 Thread David Nadlinger via Digitalmars-d-learn

On Saturday, 6 September 2014 at 16:36:38 UTC, Kagamin wrote:
Looks like mingw supports 3 types of exception handling. LDC 
usually tightly coupled with mingw version, you shouldn't try 
it blindly, but follow installation instructions instead.


It's not really tightly coupled to the MinGW version per se. What 
is required is Dwarf 2 EH and a working TLS implementation. The 
latter is the reason for the recent version of mingw-w64 
requirement, because I fixed the implementation there a year ago 
or so. No idea if the mingw.org people have gotten their act 
together since.


That being said, it still makes sense to try a known good version 
first, as LDC exercises quite a large part of the 
compiler/runtime features, some of which aren't needed in more 
wide-spread use cases (for example native TLS).


David


Re: Installing LDC on Windows

2014-09-06 Thread Trass3r via Digitalmars-d-learn
On Saturday, 6 September 2014 at 21:54:00 UTC, David Nadlinger 
wrote:

On Saturday, 6 September 2014 at 17:51:16 UTC, Trass3r wrote:

SEH was patented, so llvm doesn't support it.


That has changed.


Has it? SEH on Win64 is something entirely different from the 
original (x86) SEH design, and not covered by said patent.


Ok 2in1.
1) As far as I know the x86 SEH patent expired in June.
2) For x64 the implementation is very close now:
   
https://github.com/ldc-developers/ldc/issues/166#issuecomment-54522891


extern(C) function declaration inside a function without altering mangling

2014-09-06 Thread Timothee Cour via Digitalmars-d-learn
Is there way to declare a extern(C) function inside a function without
altering the mangled name?

Should I write a mixin for that based on pragma(mangleof) (used as
extern_C_global_scope in example below) ? Or did someone already implement
that?

extern(C) void foo1();
void fun(){
extern(C) void foo2();
mixin(extern_C_global_scope(void foo3()));
foo1(); //OK
foo2();  //will result in link error due to different mangling of foo2.
foo3();  //OK
}


Re: Automatic translation of opUnary!++ into opOpAssign!+

2014-09-06 Thread Ali Çehreli via Digitalmars-d-learn

On 12/28/2013 11:00 AM, monarch_dodra wrote:

 On Saturday, 28 December 2013 at 15:37:06 UTC, Francesco Cattoglio wrote:
 So, while I was studying the apropriate template constraints for my
 shiny new iota implementation, I found out this funny thing:

 import std.stdio;

 class Test{
 int x = 41;
 Test opOpAssign(string op)(int rhs) if (op == +) {
  x += rhs;
  return this;
 }
 }

 void main() {
 Test t1 = new Test;
 //class Test has no opUnary defined, so the following
 //gets automagically converted into (t1) += (1)
 ++t1;
 writeln(t1.x); //prints 42, correct!
 }

 This actually comes really handy, but I couldn't find it into the
 language documentation on dlang.org, so it surprised me.

Same here. I still can't find it in the documentation at least easily.

 Did I miss it in the language specification? Should we add it
 somewhere to the docs?
 Anyone with some spare time care to explain briefly what was the
 rationale behind this?

 I seem to remember that this is mentioned in TDPL? That's not spec of
 course, but I think it's mentioned here.

I just checked again. No, I can't find it in TDPL.

 I'm a bit fuzy about the shortcuts, but I *think* there are a couple
 other shortcuts like this, such as a += b = a = a + b?

No, that translation is not there.

 In any case, http://dlang.org/operatoroverloading.html; needs to be
 updated

Agreed.

Can someone who is familiar with the dmd source code enumerate such 
translations?


Thank you,
Ali



[Issue 13428] New: Add template to perform appropriate substitution for inout when it appears in a type

2014-09-06 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=13428

  Issue ID: 13428
   Summary: Add template to perform appropriate substitution for
inout when it appears in a type
   Product: D
   Version: D2
  Hardware: All
OS: All
Status: NEW
  Severity: enhancement
  Priority: P1
 Component: Phobos
  Assignee: nob...@puremagic.com
  Reporter: turkey...@gmail.com

I'm having a lot of problems with meta when inout gets involved.
There's no std.traits that deal with inout, and I think that's a bit of a
hole...

So my situation is, I have X captured by ReturnType!(T.f), and I also have T.
T.f is inout(RT)[] f() inout { return ...; }

I run into the situation where X == inout(RT)[]. I can't declare variables of
that type, and it all goes wrong.
What I need to do, is transform X into RT[], const(RT)[] or immutable(RT)[]
accordingly to T.

First problem, I can't work out how to detect if X is inout, I can't seem to
craft an is() expression that works, and there's nothing in std.traits.
After that, I need to perform the substitution, and that's proving to be really
tricky...

I think a std template could be created which will transform some type
containing inout with the appropriate mutability level taken from some other
type...

What I want is:

alias Y = SubstituteInout!(X, T); // copy the mutability of T where 'inout'
appears in X

static assert(is(SubstituteInout!(inout(T)[], const(S)) == const(T)[]);

Can anyone suggest how I might write that template? I can't work it out _

--


[Issue 13429] New: icmp (and friends) should be @nogc

2014-09-06 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=13429

  Issue ID: 13429
   Summary: icmp (and friends) should be @nogc
   Product: D
   Version: D2
  Hardware: All
OS: All
Status: NEW
  Severity: enhancement
  Priority: P1
 Component: Phobos
  Assignee: nob...@puremagic.com
  Reporter: turkey...@gmail.com

icmp (and friends) should be @nogc. It is the most frequently occurring
function blocking use of @nogc in my code.

Surely a string comparison doesn't need to allocate?

--


[Issue 13430] New: Improve error message with wrong arg type to inout function

2014-09-06 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=13430

  Issue ID: 13430
   Summary: Improve error message with wrong arg type to inout
function
   Product: D
   Version: D2
  Hardware: All
OS: All
Status: NEW
  Severity: enhancement
  Priority: P1
 Component: DMD
  Assignee: nob...@puremagic.com
  Reporter: turkey...@gmail.com

This error message had me scratching my head for half an hour. Please fix this
situation to report the appropriate error.

This code produces the error:
  Error: inout method db.ui.listadapter.S.f is not callable using a mutable
object

struct S
{
inout(int) f(int x) inout // inout method
{
return x;
}
}

void f(size_t s)
{
S x;

// call it with the wrong type (size_t, expects int)
x.f(s); // very surprising error message

// call with appropriate type, no problem
x.f(cast(int)s);
}

--


[Issue 13430] Improve error message with wrong arg type to inout function

2014-09-06 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=13430

Vladimir Panteleev thecybersha...@gmail.com changed:

   What|Removed |Added

   Keywords||diagnostic
 CC||thecybersha...@gmail.com

--


[Issue 13430] Improve error message with wrong arg type to inout function

2014-09-06 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=13430

Vladimir Panteleev thecybersha...@gmail.com changed:

   What|Removed |Added

   Severity|enhancement |minor

--


[Issue 13431] New: pragma(startaddress) doesn't work with COFF

2014-09-06 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=13431

  Issue ID: 13431
   Summary: pragma(startaddress) doesn't work with COFF
   Product: D
   Version: D2
  Hardware: x86_64
OS: Windows
Status: NEW
  Keywords: link-failure
  Severity: normal
  Priority: P1
 Component: DMD
  Assignee: nob...@puremagic.com
  Reporter: thecybersha...@gmail.com

I don't know if the COFF object file format supports indicating the entry
point, but if it does, then DMD does not emit this information when
pragma(startaddress) is used.

Example program:

// test.d //
import win32.winbase;

void start()
{
ExitProcess(0);
}

pragma(startaddress, start);


When compiling with -m64 or -m32mscoff, the linker complains:

LINK : fatal error LNK1561: entry point must be defined

--


[Issue 4890] GC.collect() deadlocks multithreaded program.

2014-09-06 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=4890

--- Comment #23 from Tomash Brechko tomash.brec...@gmail.com ---
I think the order of events is such that pthread_create() is followed by
pthread_kill() from main thread before the new thread had any chance to run. 
In this case there are reports that the new thread may miss signals on Linux:
http://stackoverflow.com/questions/14827509/does-the-new-thread-exist-when-pthread-create-returns
.  I think POSIX intent is such that pthread_kill() should work once you have
thread ID, i.e. it's a bug with (some versions of) Linux kernel (maybe the
signal is first raised and then pending signals are cleared (per POSIX) for the
new thread when it starts, or the signal is not become pending as it is not
blocked, but is not delivered either because the thread is not really running
yet; though on my 3.15.10 pthread_kill() after pthread_create() always works in
C, and I don't have D compiler at the moment to check if I'm still able to
reproduce original problem).  OTOH issue 10351 is marked as duplicate, but it's
not clear if the threads involved there are newly created.

On a side note, in thread_entryPoint() there's a place:

 // NOTE: isRunning should be set to false after the thread is
 // removed or a double-removal could occur between this
 // function and thread_suspendAll.
 Thread.remove( obj );
 obj.m_isRunning = false;

Note that if thread_suspendAll() is called after remove() but before assignment
you still will have double removal.  This shouldn't relate to bug in question
however.

--


[Issue 4890] GC.collect() deadlocks multithreaded program.

2014-09-06 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=4890

--- Comment #24 from Tomash Brechko tomash.brec...@gmail.com ---
Now I see that I was wrong about double removal, please ignore that part.

--


[Issue 13432] std.json.parseJSON does not report correct line number in Exception

2014-09-06 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=13432

murphyslaw...@gmail.com changed:

   What|Removed |Added

 CC||murphyslaw...@gmail.com

--


[Issue 13432] New: std.json.parseJSON does not report correct line number in Exception

2014-09-06 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=13432

  Issue ID: 13432
   Summary: std.json.parseJSON does not report correct line number
in Exception
   Product: D
   Version: D2
  Hardware: x86_64
OS: Linux
Status: NEW
  Severity: minor
  Priority: P1
 Component: Phobos
  Assignee: nob...@puremagic.com
  Reporter: murphyslaw...@gmail.com

Created attachment 1419
  -- https://issues.dlang.org/attachment.cgi?id=1419action=edit
simple json file with syntax error

When std.json.parseJSON is called on a string containing invalid JSON, the
returned exception always reports a syntax error on line number 1. The column
number seems to give the total number of characters parsed up to the point of
the error rather than the number of preceding characters on that line.
For example, calling parseJSON on the following:
{
  key : {
val1 : 1,
val2 : 2
  },  -- syntax error on line 5, column 4
}
throws an exception that reports 
'Found '}' when expecting ''. (Line 1:29)'

To parse, I am using test.json.readText.parseJSON

--


[Issue 13432] std.json.parseJSON does not report correct line number in Exception

2014-09-06 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=13432

--- Comment #1 from murphyslaw...@gmail.com ---
Created attachment 1420
  -- https://issues.dlang.org/attachment.cgi?id=1420action=edit
code to parse json and throw exception

--


[Issue 13433] New: Request: Clock.currTime option to use CLOCK_REALTIME_COARSE / CLOCK_REALTIME_FAST

2014-09-06 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=13433

  Issue ID: 13433
   Summary: Request: Clock.currTime option to use
CLOCK_REALTIME_COARSE / CLOCK_REALTIME_FAST
   Product: D
   Version: unspecified
  Hardware: x86
OS: Linux
Status: NEW
  Severity: enhancement
  Priority: P1
 Component: Phobos
  Assignee: nob...@puremagic.com
  Reporter: kevin.lamo...@gmail.com

While performance-testing the std.logger proposal I stumbled upon
Clock.currTime() as a very significant bottleneck.  Using a modified version of
currTime() to use CLOCK_REALTIME_COARSE instead of CLOCK_REALTIME reduced the
time spent in the overall function by 91% (from 100,000 messages/sec discarded
to 1,100,000 messages/sec).  Similar results have been posted for FreeBSD's
CLOCK_REALTIME_FAST.

I would like to see a way to get Clock.currTime to use
CLOCK_REALTIME_COARSE/FAST.  It could be as simple as SysTime currTime(bool
fastAndLoose = false), or another overload.  The documentation would have to
note that fastAndLoose time might go backward, or increment oddly.

TickDuration.currSystemTick() could do the same thing using
CLOCK_MONOTONIC_COARSE / CLOCK_MONOTONIC_FAST.

--


[Issue 10351] [GC] GC deadlocks in thread_suspendAll()

2014-09-06 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=10351

Sobirari Muhomori dfj1es...@sneakemail.com changed:

   What|Removed |Added

 Status|RESOLVED|REOPENED
 Resolution|DUPLICATE   |---
 OS|All |Linux

--- Comment #4 from Sobirari Muhomori dfj1es...@sneakemail.com ---
issue 4890 is reproduced on a newly created thread, is it the case for you? If
it's a kernel bug, say what OS, kernel version and processor (speed, cores, HT)
do you use.

--


[Issue 10351] [GC] GC deadlocks in thread_suspendAll()

2014-09-06 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=10351

--- Comment #5 from Sobirari Muhomori dfj1es...@sneakemail.com ---
also provide stack traces of other threads

--


[Issue 13428] Add template to perform appropriate substitution for inout when it appears in a type

2014-09-06 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=13428

Sobirari Muhomori dfj1es...@sneakemail.com changed:

   What|Removed |Added

URL||http://forum.dlang.org/post
   ||/mailman.472.1409989340.578
   ||3.digitalmars-d@puremagic.c
   ||om

--


[Issue 13433] Request: Clock.currTime option to use CLOCK_REALTIME_COARSE / CLOCK_REALTIME_FAST

2014-09-06 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=13433

Vladimir Panteleev thecybersha...@gmail.com changed:

   What|Removed |Added

 CC||thecybersha...@gmail.com

--- Comment #1 from Vladimir Panteleev thecybersha...@gmail.com ---
Shouldn't you be using the monotonic clock for benchmarking?

--


[Issue 13433] Request: Clock.currTime option to use CLOCK_REALTIME_COARSE / CLOCK_REALTIME_FAST

2014-09-06 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=13433

--- Comment #2 from Vladimir Panteleev thecybersha...@gmail.com ---
Oh, I see - std.logger needs the realtime clock to log the time together with
the log message.

--


[Issue 13354] Algebraic.opIndex/opIndexAssign makes wrong assumptions on the index/value type

2014-09-06 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=13354

--- Comment #4 from github-bugzi...@puremagic.com ---
Commits pushed to master at https://github.com/D-Programming-Language/phobos

https://github.com/D-Programming-Language/phobos/commit/352dee3a8961f6b0403ae781145b8e3d881ab447
Fix issue #13354 - Use a generic Variant for passing opIndex/opIndexAssign
arguments.

Also improves the error message when an incompatible index or value type is
used by printing the actual type ID instead of void[] in the thrown
exception.

https://github.com/D-Programming-Language/phobos/commit/9c8a1a5dfed7f0dc29c22da936fe964f0042562e
Merge pull request #2453 from s-ludwig/issue_13354

Fix issue #13354 - Use a generic Variant for passing opIndex/opIndexAssign
arguments.

--


[Issue 4890] GC.collect() deadlocks multithreaded program.

2014-09-06 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=4890

--- Comment #25 from Sean Kelly s...@invisibleduck.org ---
Hrm... at one point thread_entryPoint called Thread.add to add itself, but I
think the add was moved to Thread.start at some point to deal with a race.  I
had a comment in Thread.start explaining the rationale, but it looks like
Thread.start has been heavily edited and the comment is gone.  Either way,
having Thread.start call Thread.add *after* pthread_create is totally wrong, as
it leaves a window for the thread to exist and be allocating memory but be
unknown to the GC.

I think I'll have to roll back thread.d to find my original comments and see
how it used to be implemented.  Something was clearly changed here, but there's
no longer enough info to tell exactly what.

I've got to say that seeing these and other changes in core.thread without
careful documentation of what was changed and why it was done is very
frustrating.  There's simply no way to unit test for the existence or lack of
deadlocks, and the comments in this module were built up over years of bug
fixes to explain each situation and why the code was the way it was.  If
someone changes the code in this module they *must* be absolutely sure of what
they are doing and document accordingly.

--


[Issue 4890] GC.collect() deadlocks multithreaded program.

2014-09-06 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=4890

--- Comment #26 from safety0ff.bugz safety0ff.b...@gmail.com ---
(In reply to Sean Kelly from comment #25)

 I think I'll have to roll back thread.d to find my original comments and see
 how it used to be implemented.  Something was clearly changed here, but
 there's no longer enough info to tell exactly what.

This change?
https://github.com/D-Programming-Language/druntime/commit/7a731ffe0869dc

--


[Issue 13434] New: [ICE] indexing array with empty tuple causes dmd segfault

2014-09-06 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=13434

  Issue ID: 13434
   Summary: [ICE] indexing array with empty tuple causes dmd
segfault
   Product: D
   Version: unspecified
  Hardware: x86_64
OS: Linux
Status: NEW
  Severity: critical
  Priority: P1
 Component: DMD
  Assignee: nob...@puremagic.com
  Reporter: hst...@quickfur.ath.cx

Code:
--
alias tuple(A...) = A;
void main() {
float[] arr;
arr[tuple!()] = 0.0;
}
--

Indexing with a tuple of 1 integral element works correctly, and indexing with
a tuple of more than 1 element correctly generates an error message about
non-convertibility to ulong.

Indexing with an empty tuple should also generate an error message, rather than
crash.

--


[Issue 13434] [ICE] indexing array with empty tuple causes dmd segfault

2014-09-06 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=13434

hst...@quickfur.ath.cx changed:

   What|Removed |Added

   Keywords||ice

--


[Issue 13434] [ICE] indexing array with empty tuple causes dmd segfault

2014-09-06 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=13434

hst...@quickfur.ath.cx changed:

   What|Removed |Added

   Keywords||patch

--- Comment #1 from hst...@quickfur.ath.cx ---
This patch fixes it:
---
diff --git a/src/expression.c b/src/expression.c
index 9b8b80b..650f67a 100644
--- a/src/expression.c
+++ b/src/expression.c
@@ -10336,8 +10336,11 @@ Expression *IndexExp::semantic(Scope *sc)
 if (t1-ty == Ttuple) sc = sc-endCTFE();
 if (e2-type == Type::terror)
 return new ErrorExp();
-if (e2-type-ty == Ttuple  ((TupleExp *)e2)-exps-dim == 1) // bug
 fix
+if (e2-type-ty == Ttuple  ((TupleExp *)e2)-exps 
+((TupleExp *)e2)-exps-dim == 1) // bug  fix
+{
 e2 = (*((TupleExp *)e2)-exps)[0];
+}

 if (t1-ty == Tsarray || t1-ty == Tarray || t1-ty == Ttuple)
 sc = sc-pop();
---

Will submit this as a PR on Monday once internet connectivity from my home PC
is restored.

--


[Issue 13434] [ICE] indexing array with empty tuple causes dmd segfault

2014-09-06 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=13434

hst...@quickfur.ath.cx changed:

   What|Removed |Added

Version|unspecified |D2

--


[Issue 13418] uninitializedArray core.simd.Vector return incorrect type

2014-09-06 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=13418

--- Comment #1 from Kazuki Komatsu enjouzensyou.bo...@gmail.com ---
sorry.
typoCannot not - Cannot.

--


[Issue 13418] uninitializedArray core.simd.Vector return incorrect type

2014-09-06 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=13418

--- Comment #2 from Kazuki Komatsu enjouzensyou.bo...@gmail.com ---
sorry.
typoCannot not - Cannot.

--