[Issue 15464] Template parameter-dependent attributes

2015-12-28 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=15464

--- Comment #8 from Andrei Alexandrescu  ---
Ping?

--


Re: Voting For std.experimental.ndslice

2015-12-28 Thread Robert burner Schadek via Digitalmars-d
On Monday, 28 December 2015 at 18:39:47 UTC, Ilya Yaroshenko 
wrote:

Have you read the latest changes?
http://forum.dlang.org/post/djgkkrdufycyjhpma...@forum.dlang.org



I have.

The problem with the doc is that is describes what it can be used 
for, but it does not describe what it is.


It is like saying: "It brings you from point A to point B."
Instead you should say it is a car. And a car is self moving 
object 


The first few sentences:
"""
The package is designed for applications such as linear algebra, 
physics and statistics. It would be well suited to creating 
machine learning and image processing algorithms, but should also 
be general enough for use anywhere with homogeneously-typed 
multidimensional data.

"""
does not say what it is.

Should be something, as far as I understand the package, like:

"""
This package provides a multidimensional array implementation, 
suited for scientific computing. Additionally, many functions for 
iteration, accessing and manipulation are given. 

"""


Re: Better docs for D (WIP)

2015-12-28 Thread Adam D. Ruppe via Digitalmars-d-announce
On Monday, 28 December 2015 at 23:01:05 UTC, Andrei Alexandrescu 
wrote:
The signature proper is nice. The formatting of "&&" in the 
constraint is inconsistent, but I guess that's a matter with 
the formatting of the code.


Yeah, that is a css bug I just forgot about getting in to 
everything else, fixed now.


The vertical spacing post "Parameters" of 
http://dpldocs.info/findSkip is annoying.


In a simple function it may be unnecessary but doesn't really 
hurt, while in a complex type or a function with a lot of 
parameters, it improves legibility. A type alone can be a pretty 
complex beast and can warrant the use of multiple lines.


I *might* change my mind on this, Qt puts the types on one line, 
but the real question is what they look like when I finish the 
constraint analyzer. I haven't even started implementing it yet, 
but the type of haystack is not really R1. It is actually 
"duck-typed forward range", which is gleamed from the constraint.


Qt's types are rarely more complex than a class pointer. 
Sometimes, you might see a QList or a QMap, but never anything like what Phobos deals in. C++ 
doesn't have D's const and immutable, it doesn't have the dip 25 
ref checker, it doesn't use much design by introspection. 
Voldemort types both simplify the signature and make the 
explanation more complex at the same time.


So what works for us may be quite different than what works for 
them.


But once I get the constraint analyzer set up and try it on more 
real world code, if it remains legible in complex cases on one 
line (which it might, I should be able to simplify stuff like 
`!isInfinite!Range && isForwardRange!Range` into something like 
"finite forward range"), I'll revisit this.




Ideally most of these things would be adjustable via css.


Of course, it is primarily an issue of margins, and I'm mostly 
using the browser defaults for the semantic tags at this point. 
But I do want it to be good out of the box and find too much 
space to be better than too little.


Essentially it would be fantastic if the docs contained the 
semantic info and the formatting would be entirely shipped to 
css.


Yes, I agree, that is one of my goals too.


Re: Must I compile on the target architecture?

2015-12-28 Thread FrankLike via Digitalmars-d-learn

On Friday, 25 December 2015 at 12:43:05 UTC, Jakob Jenkov wrote:

Hi, just a quick question:

If I write a program in D and I use Windows for development but 
want it to run on Linux, do I have to copy the source code to 
the target Linux machine and compile it there, to make an 
executable for that machine? What is the standard process for 
cross platform compilation?


GDC is best for cross platform compilation,download it from 
gdcproject.org.


Links to the wiki for Phobos examples/tips and tricks?

2015-12-28 Thread bachmeier via Digitalmars-d
Is it acceptable to post examples/tips and tricks in the wiki, 
and then link to them in the official Phobos documentation? What 
I have in mind is adding to the documentation of a Phobos function


See Also: The [wiki](link) for additional documentation.

This would overcome two (valid IMO) complaints about the current 
system:


1. There is a lot of overhead associated with changing the 
official docs. With the wiki, you type in your new example and 
you're done. No futzing around for three hours over a period of 
several days to make a small change.

2. Dislike of Ddoc. The wiki uses markdown.

The wiki would accommodate helpful information that is not 
appropriate for the official docs:


1. Specialized examples.
2. Tips and tricks.
3. Guidance on choosing between available functions, like 
benchmarks.


The wiki has advantages over PHP-style user comments. The main 
one being that we can do it right now without having to change 
anything. Another being the fact that user comments shouldn't be 
part of the official docs, because they are unofficial, and are 
thus wiki material.


So is this something that we can do?


Re: Better watch out! D runs on watchOS!

2015-12-28 Thread Dan Olson via Digitalmars-d-announce
Joakim  writes:
>
> I don't understand how the bitcode requirement works on your own
> device: I thought that was for an Apple-submitted app that they then
> compiled to binary themselves?  Do you have to go through the same
> process even for test apps, ie no sideloading?  Or does the device
> itself take bitcode?

This is all based on my experience and I don't know the full bitcode
story.  I may state erroneous info below.

The device takes normal executables but there is a check to make sure
that each object file has the appropriate bitcode sections. I think the
linker does this, but did not check which tool in build chain spit out
the error.

The bitcode is actually two new sections in every object file:

  .section __LLVM,__bitcode
  .section __LLVM,__cmdline

The __bitcode section seems to just be the LLVM IR for the object file
in the .bc binary format. Some sources say it is a xar archive but in my
investigation I used Apple's clang with -fembed-bitcode and inspected
the IR or ARM assembly to see these two sections. Extracting and using
llvm-dis on the __bitcode section gave back the containing module's
IR in human readable format. It exactly matches the LLVM IR for its
object file sans Apple's clang -fembed-bitcode.  So not sure when xar is
used yet.

The __cmdline section appears to be some of the clang options used to
compile the bitcode.

The compile process becomes something like this:
1. Create IR for module as usual.
2. Generate the IR bitcode representation.
3. Add the two new sections, using bitcode from (2) as contents of
  __bitcode section and __cmdline options to compile it
4. Generate object from IR.

But not wanting to figure all that out now, I tried simpler things and
discovered that at least for testing, these sections only need to be
present and the contents don't seem to matter. So for now I skip 2 and
just put a zero in each.

On implication of Apple requiring bitcode: if Apple is compiling the
bitcode with their clang or llc, then it means using a modifed LLVM like
I do to support thread-locals on watchOS, tvOS, or iOS is only good for
side loading.  Probably going to have to work on plan B for
thread-locals.
-- 
Dan


Re: Voting For std.experimental.ndslice

2015-12-28 Thread Martin Nowak via Digitalmars-d

On Monday, 28 December 2015 at 07:11:00 UTC, Jack Stouffer wrote:

Voting has ended! Thanks to everyone who voted and reviewed.

The final tally:

Yes: 12
No: 0


Anything left to review/do on the PR? We're branching for 2.070 
soon, would be nice if this can make it, but only if it's really 
ready.


Stripping Data Symbols (Win64)

2015-12-28 Thread Benjamin Thaut via Digitalmars-d
My current work on the D compiler lead me to the following test 
case which I put through a unmodified version of dmd 2.069.2


import core.stdc.stdio;

struct UnusedStruct
{
int i = 3;
float f = 4.0f;
};

class UnusedClass
{
int i = 2;
float f = 5.0f;
};

void main(string[] args)
{
  printf("Hello World!");
}

When compiling this on windows with dmd -m64 main.d -L/MAP
and then inspecting the map file I noticed that the following 4 
data symbols end up in the final executable although they 
shouldn't be used.


 0003:0a90   _D4main12UnusedStruct6__initZ 
000140046a90 main.obj
 0003:0ad0   _D4main11UnusedClass6__initZ 
000140046ad0 main.obj
 0003:0af0   _D4main11UnusedClass7__ClassZ 
000140046af0 main.obj
 0003:0ba0   _D4main11UnusedClass6__vtblZ 
000140046ba0 main.obj


For the struct this is the initializer, for the class its the 
initializer, class info and vtbl.


Is this behavior correct? Shouldn't UnusedStruct and UnusedClass 
be stripped completely from the binary? Is this somehow connected 
to the module info / object.factory?


I noticed by looking at some object file dumps that dmd puts each 
function into its own section, but data symbols, like 
initializers, are all merged into the same section. Could this be 
the root issue?


Re: How to config the GDC on linux target for ARM linux?

2015-12-28 Thread ZombineDev via Digitalmars-d-learn

On Monday, 28 December 2015 at 04:52:44 UTC, FrankLike wrote:
Now I build a project for ARM linux on ubuntu 15.04 ,but build 
error.
I download the 'wiringPi' from http://wiringPi.com,convert the 
*.h to *.d.then build the 'aa.so' file:

#! /bin/sh
dfiles="max31855.d max5322.d mcp23008.d mcp23016.d 
mcp23016reg.d mcp23017.d mcp23s08.d mcp23s17.d mcp23x08.d 
mcp23x0817.d mcp3002.d mcp3004.d mcp3422.d mcp4802.d pcf8574.d 
pcf8591.d sn3218.d softPwm.d softServo.d softTone.d sr595.d 
wiringPi.d wiringPiI2C.d wiringPiSPI.d wiringSerial.d 
wiringShift.d wpiExtensions.d"


ofiles="drcSerial.o max31855.o max5322.o mcp23008.o mcp23016.o  
mcp23017.o mcp23s08.o mcp23s17.o mcp3002.o mcp3004.o mcp3422.o 
mcp4802.o pcf8574.o pcf8591.o piHiPri.o piThead.o sn3218.o 
softPwm.o softServo.o softTone.o sr595.o wiringPi.o 
wiringPiI2C.o wiringPiSPI.o wiringSerial.o wiringShift.o 
wpiExtensions.o"


 /opt/arm-unknown-linux-gnueabihf/bin/arm-linux-gnueabihf-gdc  
-o aa.so $ofiels $dfiles  -shared

---my.d
import wiringPi;
import std.stdio;

void main()
{
writeln("start");
wiringPiSetup();
pinMode(0,OUTPUT);
while(1)
{
digitalWrite(0,HIGH);
delay(500);
digitalWrite(0,LOW);
delay(500);
}
return;
}
-build the my execute file
/opt/arm-unknown-linux-gnueabihf/bin/arm-linux-gnueabihf-gdc  
-o my  my.d aa.so -I./wiringPi/WiringPi/


-now get the error:
my.d:1:8: error: module wiringPi is in file 'wiringPi.d' which 
cannot be read

 import wiringPi;
^
import path[0] = 
/opt/arm-unknown-linux-gnueabihf/lib/gcc/arm-unknown-linux-gnueabihf/5.2.0/include/d
-I copy the *.d to 
/opt/arm-unknown-linux-gnueabihf/lib/gcc/arm-unknown-linux-gnueabihf/5.2.0/include/d

it's ok ,but where is the file for config?
-get another error:
/tmp/cc7M1B9I.o: In function `_Dmain':
my.d:(.text+0x60): undefined reference to `wiringPiSetup'
my.d:(.text+0x6c): undefined reference to `pinMode'
my.d:(.text+0x84): undefined reference to `digitalWrite'
my.d:(.text+0x8c): undefined reference to `delay'
my.d:(.text+0x98): undefined reference to `digitalWrite'
my.d:(.text+0xa0): undefined reference to `delay'
collect2: error: ld returned 1 exit status
-end

I'm not known the GDC config file ,and maybe I use the error 
build .

Who can help me?
 thank you.


About the first error ("...module wiringPi is in file 
'wiringPi.d' which cannot be read...") - are you sure that the 
dfiles are in "./wiringPi/WiringPi/"? The compiler reports that 
it can't find them there.
You can try copying the WiringPi dfiles in the same folder as 
"my.d".


About the second error - you need to verify that aa.so actually 
has those symbols that the linker reports as "undefined 
reference". You can do this with readlelf or nm. For more info 
see 
here:http://stackoverflow.com/questions/1237575/how-do-i-find-out-what-all-symbols-are-exported-from-a-shared-object


Re: GTKD drawing area remains white even SourceRgb is changed

2015-12-28 Thread Mike Wey via Digitalmars-d-learn

On 12/28/2015 12:29 AM, TheDGuy wrote:

My code:

http://dpaste.com/1X3E1HW

i store colors in the accumulator-array and draw them via
"cr.rectangle()". Because i have some problems with the code i set the
SourceRgb-color to a constant value but if i execute the program, the
window remains white.


The values passed to setSourceRgb should be between 0 and 1.

--
Mike Wey


[Issue 14804] Comparing two Nullables does not check if either is null

2015-12-28 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=14804

--- Comment #3 from b2.t...@gmx.com ---
(In reply to monkeyworks12 from comment #2)
> but let's not close this one for opEquals.

Without great convictionI've opened the PR, but let's the official maintainers
take the decision ;)

https://github.com/D-Programming-Language/phobos/pull/3887

--


Re: pl0stuff an optimizing pl0 > c transcompiler

2015-12-28 Thread Nick B via Digitalmars-d-announce

On Sunday, 27 December 2015 at 21:13:07 UTC, Stefan Koch wrote:

Hello again.








please feel free to comment or ask questions here.


Hi.

what languages do you plan to support for input and output ?


Article on D for CVu or Overload

2015-12-28 Thread Russel Winder via Digitalmars-d
Is anyone up for writing an article or two on D for publication in the
CVu or Overload journals as an act of D-efiance? There are to be a 1-
day D workshop and a keynote session t the conference, it would be good
to "leverage" this as part of the campaign to show that C++ is a 20th
century language and D a 21st century one.

I am happy to co-author if that helps. ASCIIDoctor the only source form
usable though.

-- 
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


vibe.d benchmarks

2015-12-28 Thread Ola Fosheim Grøstad via Digitalmars-d

https://www.techempower.com/benchmarks/

The entries for vibe.d are either doing very poorly or fail to 
complete. Maybe someone should look into this?




Re: How to config the GDC on linux target for ARM linux?

2015-12-28 Thread FrankLike via Digitalmars-d-learn

On Monday, 28 December 2015 at 13:17:04 UTC, FrankLike wrote:
About the first error ("...module wiringPi is in file 
'wiringPi.d' which cannot be read...") - are you sure that the 
dfiles are in "./wiringPi/WiringPi/"? The compiler reports 
that it can't find them there.
You can try copying the WiringPi dfiles in the same folder as 
"my.d".


About the second error - you need to verify that aa.so 
actually has those symbols that the linker reports as 
"undefined reference". You can do this with readlelf or nm. 
For more info see 
here:http://stackoverflow.com/questions/1237575/how-do-i-find-out-what-all-symbols-are-exported-from-a-shared-object


 Thank you,but can you tell me that what is right way to use GDC
 on linux,such as d refer a c lib.
for eacample:
a.d refer  x.h x.c
 how  do you build it by GDC?
 what's your steps?
 How to config the GDC for the third part c libaries and d 
files,such as PATH.


 Thank you,waiting for your answer.




Re: Better watch out! D runs on watchOS!

2015-12-28 Thread Jacob Carlborg via Digitalmars-d-announce

On 2015-12-28 09:45, Dan Olson wrote:


On implication of Apple requiring bitcode: if Apple is compiling the
bitcode with their clang or llc, then it means using a modifed LLVM like
I do to support thread-locals on watchOS, tvOS, or iOS is only good for
side loading.  Probably going to have to work on plan B for
thread-locals.


Would it be possible to bypass LLVM and do the thread local specific 
parts in LDC?


--
/Jacob Carlborg


Re: Must I compile on the target architecture?

2015-12-28 Thread Joakim via Digitalmars-d-learn

On Friday, 25 December 2015 at 12:43:05 UTC, Jakob Jenkov wrote:

Hi, just a quick question:

If I write a program in D and I use Windows for development but 
want it to run on Linux, do I have to copy the source code to 
the target Linux machine and compile it there, to make an 
executable for that machine? What is the standard process for 
cross platform compilation?


I'll also note that ldc supports cross-compilation out of the 
box.  The only issue is that you'll need a linker to link the 
resulting objects, but you can usually install one in Cygwin.  I 
believe gdc also supports some cross-compilation, though I've not 
tried it.  Dmd isn't a cross-compiler, though it is capable of 
being turned into one: nobody has put in the remaining work yet.


Re: Lots of D code

2015-12-28 Thread Basile B. via Digitalmars-d-learn
On Wednesday, 23 December 2015 at 00:59:53 UTC, steven kladitis 
wrote:
I have 843 programs written in D. 805 actually create an 32 bit 
exe in windows 10. I am running the latest D.  Some just start 
to link and the linker disappears. Some just have issues I am  
not able figure out. I can attach the code and scripts I use to 
compile and run these. If anyone is willing to figure out why 
the 38 do not compile, I would appreciate code that works.  The 
execute_bf_v2.d creates an exe that is small but takes about 1 
hour to link on a 12 core processor with 64g of ram as 14tb of 
disk space. The rest link very fast.  If anyone is interested, 
let me know.  I would love to get the 38 working.  Also there 
are a few that produce incorrect answers.  The Generate_maze.d  
produces all but the last line of the maze.  I added a line 
just for it.  I do not understand why.  All of the programs are 
from RosettaCode.org. The  script to compile them generates a 
log file and you will see a few that the linker just stops 
No idea why. A few have 64K link errors no idea why.



TIA,
Steven


what's up ?

;)

Did you upload, so that bugs can be verified ?


Re: Lots of D code

2015-12-28 Thread Ivan Kazmenko via Digitalmars-d-learn

On Monday, 28 December 2015 at 14:24:04 UTC, Basile B. wrote:
On Wednesday, 23 December 2015 at 00:59:53 UTC, steven kladitis 
wrote:

...
All of the programs are from RosettaCode.org. The  script to 
compile them generates a log file and you will see a few that 
the linker just stops No idea why. A few have 64K link 
errors no idea why.



TIA,
Steven


what's up ?

;)

Did you upload, so that bugs can be verified ?


As the original poster mentioned RosettaCode, perhaps they are 
just programs from http://rosettacode.org/wiki/D ?  There are 742 
entries, but some (like 
http://rosettacode.org/wiki/99_Bottles_of_Beer#D) contain more 
than one D program.


Re: Multiple selective imports on one line

2015-12-28 Thread Joakim via Digitalmars-d-learn

On Monday, 28 December 2015 at 14:16:36 UTC, Basile B. wrote:

On Monday, 28 December 2015 at 14:09:30 UTC, Joakim wrote:
I wish dfmt could do this for us, so that you develop with all 
the modules imported at the top, then run dfmt and it scopes 
all the imports and adds the selective import of symbols.  
I've been thinking about implementing a tool to do this 
myself, will get around to it someday.


This is not formating (what DFMT is aimed to do) this is 
refactoring.


You're right, I was thinking about patching Dscanner to do it, 
just mentioned dfmt here without thinking about that aspect.


Re: How to config the GDC on linux target for ARM linux?

2015-12-28 Thread FrankLike via Digitalmars-d-learn

 I've gotten the answer: use the difference 'gcc' for c code.
---For x86_64:
#! /bin/sh
dfiles="max31855.d max5322.d mcp23008.d mcp23016.d mcp23016reg.d 
mcp23017.d mcp23s08.d mcp23s17.d mcp23x08.d mcp23x0817.d 
mcp3002.d mcp3004.d mcp3422.d mcp4802.d pcf8574.d pcf8591.d 
sn3218.d softPwm.d softServo.d softTone.d sr595.d wiringPi.d 
wiringPiI2C.d wiringPiSPI.d wiringSerial.d wiringShift.d 
wpiExtensions.d"


ofiles="drcSerial.o max31855.o max5322.o mcp23008.o mcp23016.o  
mcp23017.o mcp23s08.o mcp23s17.o mcp3002.o mcp3004.o mcp3422.o 
mcp4802.o pcf8574.o pcf8591.o piHiPri.o piThread.o sn3218.o 
softPwm.o softServo.o softTone.o sr595.o wiringPi.o wiringPiI2C.o 
wiringPiSPI.o wiringSerial.o wiringShift.o wpiExtensions.o"



gcc -c *.c -m64
/opt/x86_64-pc-linux-gnu/bin/x86_64-linux-gnu-gdc -o my my.d   
$ofiles -I$dfiles


For ARM:

#! /bin/sh
cfiles="wiringPi.c max31855.c max5322.c mcp23008.c mcp23016.c  
mcp23017.c mcp23s08.c mcp23s17.c mcp3002.c mcp3004.c mcp3422.c 
mcp4802.c pcf8574.c pcf8591.c sn3218.c softPwm.c softServo.c 
softTone.c sr595.c  wiringPiI2C.c wiringPiSPI.c wiringSerial.c 
wiringShift.c wpiExtensions.c"


dfiles="max31855.d max5322.d mcp23008.d mcp23016.d mcp23016reg.d 
mcp23017.d mcp23s08.d mcp23s17.d mcp23x08.d mcp23x0817.d 
mcp3002.d mcp3004.d mcp3422.d mcp4802.d pcf8574.d pcf8591.d 
sn3218.d softPwm.d softServo.d softTone.d sr595.d wiringPi.d 
wiringPiI2C.d wiringPiSPI.d wiringSerial.d wiringShift.d 
wpiExtensions.d"


ofiles="drcSerial.o max31855.o max5322.o mcp23008.o mcp23016.o  
mcp23017.o mcp23s08.o mcp23s17.o mcp3002.o mcp3004.o mcp3422.o 
mcp4802.o pcf8574.o pcf8591.o piHiPri.o piThread.o sn3218.o 
softPwm.o softServo.o softTone.o sr595.o wiringPi.o wiringPiI2C.o 
wiringPiSPI.o wiringSerial.o wiringShift.o wpiExtensions.o"


/opt/arm-unknown-linux-gnueabihf/bin/arm-unknown-linux-gnueabihf-gcc -marm  -c 
$cfiles
/opt/arm-unknown-linux-gnueabihf/bin/arm-unknown-linux-gnueabihf-gdc  -o my 
my.d   $ofiles -I$dfiles


Re: Three Cool Things about D

2015-12-28 Thread Rory McGuire via Digitalmars-d-announce
On 27 Dec 2015 6:25 PM, "Andrei Alexandrescu via Digitalmars-d-announce" <
digitalmars-d-announce@puremagic.com> wrote:
>
> On 12/27/15 1:27 AM, Rory McGuire via Digitalmars-d-announce wrote:
[snip]
>> Vibe.d had a template engine called diet which is almost like Jade. It
>> is also completed so you might prefer that as an example.
>
>
> Either or both would be awesome to express with Pegged. -- Andrei
>

I'm working on the output part now while it's the holidays. Will share once
I've got my test template translating to html as a demo.


Re: So You Want To Write Your Own Language

2015-12-28 Thread Jacob Carlborg via Digitalmars-d-announce

On 2015-12-27 00:55, Walter Bright wrote:


Many of the lowerings require semantic information that is not available
from ASTs.


Hence the "in theory" ;). It's hard to tell what would be possible to 
implement with AST macros without implementing the complete macro system 
and use it. Of course it's possible to look what's possible in other 
languages.


--
/Jacob Carlborg


Re: D Consortium as Book / App Publisher... ?

2015-12-28 Thread Wyatt via Digitalmars-d
On Sunday, 27 December 2015 at 14:44:37 UTC, Ola Fosheim Grøstad 
wrote:


I think wannabe game programmers is a sizeable market. 
Programmers that dont have the capacity to learn modern C++ and 
would pay for a quality tutorial of how to build a commercial 
level game using OpenGL, OpenAL and a physics engine, with 
downloadable chapter by chapter source code.


This may have potential.  Sort of like that old "Game Programming 
Gems" book series, only geared for a specific language.


-Wyatt


Re: Is it possible to elegantly create a range over a binary heap?

2015-12-28 Thread Gary Willoughby via Digitalmars-d-learn

On Sunday, 27 December 2015 at 22:42:21 UTC, Ivan Kazmenko wrote:
If you implement a struct with range primitives over it, you 
can use it as a range.


See the second code example in std.container.binaryheap's docs 
at

http://dlang.org/phobos/std_container_binaryheap.html#.BinaryHeap.

Or do you mean you want to print variables in order without 
modifying the array?  Sounds like this would require at least N 
log N time and N additional memory for an N-element heap anyway 
(or quadratic time and constant memory).  So, you can just copy 
the array and exhaust the copied binary heap, getting the same 
asymptotic complexity: N log N time and N additional memory.


Ivan Kazmenko.


Thanks. I wanted to iterate through the range without modifying 
the original array but like you said the only way to do that is 
by copying the data which is not ideal.


std.container.binaryheap looks like it implements the range 
interface and consumes the original during iteration. I'll 
probably do that too.


Re: vibe.d benchmarks

2015-12-28 Thread Charles via Digitalmars-d
On Monday, 28 December 2015 at 12:24:17 UTC, Ola Fosheim Grøstad 
wrote:

https://www.techempower.com/benchmarks/

The entries for vibe.d are either doing very poorly or fail to 
complete. Maybe someone should look into this?


Sönke is already on it.

http://forum.rejectedsoftware.com/groups/rejectedsoftware.vibed/post/29110


Re: Is it possible to elegantly create a range over a binary heap?

2015-12-28 Thread Ivan Kazmenko via Digitalmars-d-learn
On Monday, 28 December 2015 at 12:58:36 UTC, Gary Willoughby 
wrote:
On Sunday, 27 December 2015 at 22:42:21 UTC, Ivan Kazmenko 
wrote:
Or do you mean you want to print variables in order without 
modifying the array?  Sounds like this would require at least 
N log N time and N additional memory for an N-element heap 
anyway (or quadratic time and constant memory).  So, you can 
just copy the array and exhaust the copied binary heap, 
getting the same asymptotic complexity: N log N time and N 
additional memory.


Thanks. I wanted to iterate through the range without modifying 
the original array but like you said the only way to do that is 
by copying the data which is not ideal.


Hmm.  On second thought:

1. You can find maximum, then second maximum, then third maximum 
and so on - each in constant memory and linear time.  So, if 
performance is somehow not an issue, there is a way to do it 
@nogc but in N^2 operations.


2. If you output the whole array anyway, you may sort the array 
in place.  A sorted array obeys the heap property, so subsequent 
heap operations will still work.


3. The tricky part is when we want to support parallel iteration 
over the same heap.  If we look closely at one iteration of 
heapsort algorithm, it will perhaps become clear how to output 
values so that the array is a heap between any two consecutive 
output operations.  At the very least, our heap struct over the 
array can just track which part of the array is already sorted, 
and work with it separately.


4. Reading and modifying the heap in parallel at the same time 
does not look possible anyway, so this is as far as we can get.


Ivan Kazmenko.



Re: Multiple selective imports on one line

2015-12-28 Thread Joakim via Digitalmars-d-learn

On Wednesday, 23 December 2015 at 10:51:52 UTC, earthfront wrote:
I'm using hackerpilot's excellent textadept plugin + DCD, Dfmt, 
and Dscanner.
Upon saving files, it produces suggestions, much like warnings 
from the compiler.


One suggestion is to use selective imports in local scopes. OK, 
I'll do that.


Now I'm left with a smattering of lines which are just 
selective imports from a single module:

void foo()
{
  import std.exception:enforce;
  import std.algorithm:array;
  import std.algorithm.iteration:filter;
  import std.functional:memoize;

  //..Work..
}

What is the proper way to combine these into one line?


You really shouldn't have to do this by hand.  I wish dfmt could 
do this for us, so that you develop with all the modules imported 
at the top, then run dfmt and it scopes all the imports and adds 
the selective import of symbols.  I've been thinking about 
implementing a tool to do this myself, will get around to it 
someday.


Re: Three Cool Things about D

2015-12-28 Thread Jacob Carlborg via Digitalmars-d-announce

On 2015-12-27 17:23, Andrei Alexandrescu wrote:


That looks pretty cool! -- Andrei


It's based on Haml which is pretty well known as well.

--
/Jacob Carlborg


Re: How to use GDC to get .a file on Linux?

2015-12-28 Thread FrankLike via Digitalmars-d-learn

On Sunday, 27 December 2015 at 17:19:26 UTC, Mike Parker wrote:

On Sunday, 27 December 2015 at 15:19:21 UTC, FrankLike wrote:

Hi,
   Now I need get the .a file on Linux,target system is ARM.
   If you use gcc ,you will use the 'ar' to get .a file,
but how to do by GDC ?
And how to  get the execute file by .a file and .d file?

Thank you.


Just use ar on the generated object files the same way you 
would if you were using gcc.


Thank you,but the error is not ok.maybe some PATH is error,I 
don't how to set.


Re: How to config the GDC on linux target for ARM linux?

2015-12-28 Thread FrankLike via Digitalmars-d-learn
About the first error ("...module wiringPi is in file 
'wiringPi.d' which cannot be read...") - are you sure that the 
dfiles are in "./wiringPi/WiringPi/"? The compiler reports that 
it can't find them there.
You can try copying the WiringPi dfiles in the same folder as 
"my.d".


About the second error - you need to verify that aa.so actually 
has those symbols that the linker reports as "undefined 
reference". You can do this with readlelf or nm. For more info 
see 
here:http://stackoverflow.com/questions/1237575/how-do-i-find-out-what-all-symbols-are-exported-from-a-shared-object


Thank you,but can you tell me that what is right way to use GDC 
on linux,such as d refer a c lib.

for eacample:
a.d refer  x.h x.c
how  do you build it by GDC?
what's your steps?
How to config the GDC for the thirty c lib and d files.

Thank you,waiting for your answer.


Re: Variable below zero but if statement doesn't grab?

2015-12-28 Thread jkpl via Digitalmars-d-learn

On Sunday, 27 December 2015 at 16:00:34 UTC, jkpl wrote:

On Sunday, 27 December 2015 at 15:53:55 UTC, TheDGuy wrote:

Any idea what i am doing wrong?
https://www.youtube.com/watch?v=j_VCa-5VeP8


You could post the code also, personnaly I'm always almost at 2 
meters from my screen, with zoom, so I can't read the code...


I work more or less lying on a futon. Desks are so cheesy...


are MRV as an optimization well known ?

2015-12-28 Thread Basile B. via Digitalmars-d-learn
While working on a framework, I've found that Multiple Return 
Values (MRV) are clearly an optimization. I'de like to write a 
small D blog post about this but I don't know If it's clever 
enough or if it's a well know fact.


My base D material is this:

---
#!runnable-flags: -O -boundscheck=off -release
module runnable;

struct Get
{
static auto all()
{
import std.typecons;
return tuple(0.1f,0.2f,0.3f,0.4f);
}
static float a(){return 0.1f;}
static float b(){return 0.2f;}
static float c(){return 0.3f;}
static float d(){return 0.4f;}
}

void call(float a, float b, float c, float d){}

void tupYes()
{
call(Get.all[0..$]);
}

void tupNo()
{
call(Get.a, Get.b, Get.c, Get.d);
}

void main(string[] args)
{
import disassembler;
import std.stdio;

symbolTable.addModule!runnable;
writeln(prettyDisasm());
writeln;
writeln(prettyDisasm());
}
---

with my d beaengine bindings I get this (bin comes from DMD 
backend) :


;--- SUB 0044C918h ---
; NAMED: tupYes
0044C918h  push rbp
0044C919h  mov rbp, rsp
0044C91Ch  sub rsp, 20h
0044C920h  call 0044C8A0h
0044C925h  movsd qword ptr [rbp-20h], xmm0
0044C92Ah  fld qword ptr [rbp-20h]
0044C92Dh  movsd qword ptr [rbp-20h], xmm1
0044C932h  fld qword ptr [rbp-20h]
0044C935h  fstp qword ptr [rbp-08h]
0044C938h  fstp qword ptr [rbp-10h]
0044C93Bh  movss xmm3, dword ptr [rbp-10h]
0044C940h  movss xmm2, dword ptr [rbp-0Ch]
0044C945h  movss xmm1, dword ptr [rbp-08h]
0044C94Ah  movss xmm0, dword ptr [rbp-04h]
0044C94Fh  call 0044C910h ; (call)
0044C954h  mov rsp, rbp
0044C957h  pop rbp
0044C958h  ret
;-

;--- SUB 0044C960h ---
; NAMED: tupNo
0044C960h  sub rsp, 78h
0044C964h  call 0044C8D0h
0044C969h  movss dword ptr [rsp], xmm0
0044C96Eh  movss xmm3, dword ptr [rsp]
0044C973h  movapd dqword ptr [rsp+10h], xmm3
0044C979h  call 0044C8E0h
0044C97Eh  movss dword ptr [rsp], xmm0
0044C983h  movss xmm2, dword ptr [rsp]
0044C988h  movapd xmm3, dqword ptr [rsp+10h]
0044C98Eh  movapd dqword ptr [rsp+20h], xmm2
0044C994h  movapd dqword ptr [rsp+30h], xmm3
0044C99Ah  call 0044C8F0h
0044C99Fh  movss dword ptr [rsp], xmm0
0044C9A4h  movss xmm1, dword ptr [rsp]
0044C9A9h  movapd xmm2, dqword ptr [rsp+20h]
0044C9AFh  movapd xmm3, dqword ptr [rsp+30h]
0044C9B5h  movapd dqword ptr [rsp+40h], xmm1
0044C9BBh  movapd dqword ptr [rsp+50h], xmm2
0044C9C1h  movapd dqword ptr [rsp+60h], xmm3
0044C9C7h  call 0044C900h
0044C9CCh  movapd xmm1, dqword ptr [rsp+40h]
0044C9D2h  movapd xmm2, dqword ptr [rsp+50h]
0044C9D8h  movapd xmm3, dqword ptr [rsp+60h]
0044C9DEh  call 0044C910h ; (call)
0044C9E3h  add rsp, 78h
0044C9E7h  ret
;-

Which clearly shows that using the MRV version is faster than 
grabing each property, since in the second, version there's a 
call for each parameter.


When I google "MRV optimization tuple", there's nothing, maybe 
some garbages from the early 2000's...nothing else. I'd like your 
mind before writing something possibly ridiculous.


Re: are MRV as an optimization well known ?

2015-12-28 Thread Basile B. via Digitalmars-d-learn
I mean it's maybe "just" a special case of RVO, since tuples are 
processed as structs ?





[Issue 15481] GC profiler thinks reducing array.length triggers reallocation

2015-12-28 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=15481

ag0ae...@gmail.com changed:

   What|Removed |Added

 CC||ag0ae...@gmail.com
Summary|Reducing array.length   |GC profiler thinks reducing
   |triggers reallocation   |array.length triggers
   ||reallocation

--- Comment #1 from ag0ae...@gmail.com ---
This is a bug in the GC profiler. The array is not relocated. You can check by
comparing the pointers:


void main()
{
int[] arr;
arr.length = 7;
int* p = arr.ptr;
arr.length = 6;
assert(arr.ptr == p); /* passes */
}


I'm changing the title of this issue accordingly.

--


Re: Multiple selective imports on one line

2015-12-28 Thread Basile B. via Digitalmars-d-learn

On Monday, 28 December 2015 at 14:16:36 UTC, Basile B. wrote:

On Monday, 28 December 2015 at 14:09:30 UTC, Joakim wrote:
I wish dfmt could do this for us, so that you develop with all 
the modules imported at the top, then run dfmt and it scopes 
all the imports and adds the selective import of symbols.  
I've been thinking about implementing a tool to do this 
myself, will get around to it someday.


This is not formating (what DFMT is aimed to do) this is 
refactoring.


oops, my answer could lead to a misunderstanding. I meant:

This is not formating (what DFMT is aimed to do), but rather 
refactoring.




Re: Multiple selective imports on one line

2015-12-28 Thread Basile B. via Digitalmars-d-learn

On Monday, 28 December 2015 at 14:09:30 UTC, Joakim wrote:
I wish dfmt could do this for us, so that you develop with all 
the modules imported at the top, then run dfmt and it scopes 
all the imports and adds the selective import of symbols.  I've 
been thinking about implementing a tool to do this myself, will 
get around to it someday.


This is not formating (what DFMT is aimed to do) this is 
refactoring.


[Issue 15481] GC profiler thinks reducing array.length triggers reallocation

2015-12-28 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=15481

--- Comment #2 from Valentin Milea  ---
Maybe the reallocation function is called and returns the same buffer. But why
call it in the first place, if reducing array length is supposed to be
_equivalent_ to slicing?

--


Re: Voting For std.experimental.ndslice

2015-12-28 Thread Ilya Yaroshenko via Digitalmars-d

On Monday, 28 December 2015 at 11:13:57 UTC, Martin Nowak wrote:
On Monday, 28 December 2015 at 07:11:00 UTC, Jack Stouffer 
wrote:

Voting has ended! Thanks to everyone who voted and reviewed.

The final tally:

Yes: 12
No: 0


Anything left to review/do on the PR?


Very minor DDOC style hack can be fixed. I will fix it during 
first alpha version. The following console code can not be placed 
with CCODE macros because looks like `Usage:` word breaks it. So 
it is D CODE with `default` and `is` keywords highlighted for now.



$ median-filter --help
Usage: median-filter [] []
options:
 --nr number of rows in window, default value is 3
 --nc number of columns in window default value equals to nr
-h --help This help information.


We're branching for 2.070 soon, would be nice if this can make 
it, but only if it's really ready.


Whooohooo!

Thanks!

Ilya


programmatically get -I and -L flags from dmd; dmd.conf should prepend instead of append?

2015-12-28 Thread Timothee Cour via Digitalmars-d
I'd like to have a command line flag for dmd (and ldc,gdc) that would be
the analog to:
llvm-config --ldflags --cflags
ie, would print the corresponding flags used by dmd after following the
internal logic (look for dmd.conf in a number of directories, look for
DFLAGS environment variable etc).

one use case among others:

when using 'dmd -L-Lfoo -lbar ...', i'd like to first guess which linker
flags are used by dmd (eg transforming -L-L%@P% into -L-Lsome_path) and
then call:
'dmd -L-Lsome_path -L-Lfoo -lbar ...'

Note that what's actually called is instead:
'dmd -L-Lfoo -lbar ... -L-Lsome_path '
ie, dmd appends instead of prepends the library search path given by
dmd.conf, which leads to weird behavior if foo (from -L-Lfoo) contains an
unwanted version of libphobos2


Re: are MRV as an optimization well known ?

2015-12-28 Thread Basile B. via Digitalmars-d-learn

On Monday, 28 December 2015 at 12:40:09 UTC, Basile B. wrote:
I mean it's maybe "just" a special case of RVO, since tuples 
are processed as structs ?


Also in the second version the stack size is modified by 78 
bytes. Not when using MRV.


vibe.d / GUI integration

2015-12-28 Thread Robert M. Münch via Digitalmars-d-learn

Hi, I have two questions regarding the following, IMO very cool, vibe feature:

"Contrary to most other frameworks supporting asynchronous I/O, vibe.d 
fully integrates with the UI event loop, so that it can be used to 
power applications with a graphical user interface."


1. Am I right, that there is no GUI event handling for OSX support yet? 
If, are there are any technical limitations in vibe that it couldn't be 
added?


2. Are there are any examples WRT to using vibe with a GUI event loop?

Best regards.

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



Re: Voting For std.experimental.ndslice

2015-12-28 Thread Jack Stouffer via Digitalmars-d

On Monday, 28 December 2015 at 11:13:57 UTC, Martin Nowak wrote:
On Monday, 28 December 2015 at 07:11:00 UTC, Jack Stouffer 
wrote:

Voting has ended! Thanks to everyone who voted and reviewed.

The final tally:

Yes: 12
No: 0


Anything left to review/do on the PR? We're branching for 2.070 
soon, would be nice if this can make it, but only if it's 
really ready.


I believe, with Ilya's recent doc fix, it's ready to go.


Re: How to use GDC to get .a file on Linux?

2015-12-28 Thread FrankLike via Digitalmars-d-learn

Answer is here:
http://forum.dlang.org/thread/txvntyahlaewutzzw...@forum.dlang.org




Re: Voting For std.experimental.ndslice

2015-12-28 Thread Jack Stouffer via Digitalmars-d
On Monday, 28 December 2015 at 15:52:09 UTC, Robert burner 
Schadek wrote:
Please do not merge this with the current state of 
documentation.


Could you elaborate what issues you have with the docs? All of 
the functions have Params and Returns sections and the examples 
show what each function does.


Re: Variable below zero but if statement doesn't grab?

2015-12-28 Thread rumbu via Digitalmars-d-learn

On Sunday, 27 December 2015 at 23:24:55 UTC, TheDGuy wrote:

On Sunday, 27 December 2015 at 22:51:27 UTC, Ali Çehreli wrote:

On 12/27/2015 07:53 AM, TheDGuy wrote:

Any idea what i am doing wrong?
https://www.youtube.com/watch?v=j_VCa-5VeP8


YouTube says that the video has been removed by the user. 
That's exactly the reason why I don't like even dpaste. There 
is no guarantee that such threads will be useful forever. :) 
For me, sample code should be right here, and it should be 
short enough to practically be here.


Ali


I deleted the video because the problem was solved, it was 
neither a problem with the single '&' nor with my code it just 
showed a strange behaviour while debugging but the function 
returned the right value. Sample code is in my second post.


Get used to it :) Unfortunately, DMD is not emitting the best 
debug information. The program flow is correct, but the line info 
is not, that's why the execution step will not be triggered in 
the real location of the source code.


The simplest example is this:

import std.stdio;

void foo(int x)
{
if (x > 0)  //step 1, correct
{
writeln("bigger");  //step 2, correct
}
else
{
writeln("lower");   //step 3, wrong
}
}

int main(string[] argv)
{
foo(20);   //breakpoint with step in
return 0;
}

If you really want to confuse the debugger, write some asserts or 
contracts here and there and your program will be impossible to 
debug :)


Re: GDC build wiringPi for 'Raspberry Pi',here is error info

2015-12-28 Thread FrankLike via Digitalmars-d-learn

Answer is here:
http://forum.dlang.org/thread/txvntyahlaewutzzw...@forum.dlang.org


Re: pl0stuff an optimizing pl0 > c transcompiler

2015-12-28 Thread Stefan Koch via Digitalmars-d-announce

On Monday, 28 December 2015 at 10:45:59 UTC, Nick B wrote:

what languages do you plan to support for input and output ?


I just planned on PL/0 as input and C as output.
It is a simple one-pass (okay 2 pass if you count the optimizer) 
trans-compilation.


There is no middle-end.

And very little verification. Everything that parses will produce 
an c-output.

Which does may or may not compile.

Since PL/0 just one type.
Int

you can get away with anything :)


Re: Variable below zero but if statement doesn't grab?

2015-12-28 Thread Basile B. via Digitalmars-d-learn

On Monday, 28 December 2015 at 15:07:08 UTC, jkpl wrote:

On Sunday, 27 December 2015 at 16:00:34 UTC, jkpl wrote:

On Sunday, 27 December 2015 at 15:53:55 UTC, TheDGuy wrote:

Any idea what i am doing wrong?
https://www.youtube.com/watch?v=j_VCa-5VeP8


You could post the code also, personnaly I'm always almost at 
2 meters from my screen, with zoom, so I can't read the code...


I work more or less lying on a futon. Desks are so cheesy...


Anarchism is comfy...




Re: Voting For std.experimental.ndslice

2015-12-28 Thread Robert burner Schadek via Digitalmars-d

On Monday, 28 December 2015 at 07:11:00 UTC, Jack Stouffer wrote:

The final tally:

Yes: 12
No: 0


This is not true, my yes was conditional and the documentation is 
still weak. So it is


Yes: 11
Yes: Conditional
No: 0

Please do not merge this with the current state of documentation.




Re: Article on D for CVu or Overload

2015-12-28 Thread Jakob Jenkov via Digitalmars-d

On Monday, 28 December 2015 at 11:40:50 UTC, Russel Winder wrote:
Is anyone up for writing an article or two on D for publication 
in the CVu or Overload journals as an act of D-efiance? There 
are to be a 1- day D workshop and a keynote session t the 
conference, it would be good to "leverage" this as part of the 
campaign to show that C++ is a 20th century language and D a 
21st century one.


I am happy to co-author if that helps. ASCIIDoctor the only 
source form usable though.



What would the topics be?

How long?

What are the deadlines?




Re: Variable below zero but if statement doesn't grab?

2015-12-28 Thread jkpl via Digitalmars-d-learn

On Monday, 28 December 2015 at 18:02:53 UTC, jkpl wrote:

On Monday, 28 December 2015 at 15:50:06 UTC, Basile B. wrote:

On Monday, 28 December 2015 at 15:07:08 UTC, jkpl wrote:

On Sunday, 27 December 2015 at 16:00:34 UTC, jkpl wrote:

On Sunday, 27 December 2015 at 15:53:55 UTC, TheDGuy wrote:

Any idea what i am doing wrong?
https://www.youtube.com/watch?v=j_VCa-5VeP8


You could post the code also, personnaly I'm always almost 
at 2 meters from my screen, with zoom, so I can't read the 
code...


I work more or less lying on a futon. Desks are so cheesy...


Anarchism is comfy...


when I'm tired with the conformism I just let my head go on the 
pillow and I sleep...

(snoring)

Even if I dont't think that you have won:
https://youtu.be/Uj_7kTwRMKE?t=2m35s


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

tous fashos: juif, chrétien, musulmans,...

Il n'y a bien que les communistes qui ont compris que les 
religions c'est de la merde.


Re: Voting For std.experimental.ndslice

2015-12-28 Thread Andrei Alexandrescu via Digitalmars-d

On 12/28/2015 09:57 AM, Jack Stouffer wrote:

On Monday, 28 December 2015 at 11:13:57 UTC, Martin Nowak wrote:

On Monday, 28 December 2015 at 07:11:00 UTC, Jack Stouffer wrote:

Voting has ended! Thanks to everyone who voted and reviewed.

The final tally:

Yes: 12
No: 0


Anything left to review/do on the PR? We're branching for 2.070 soon,
would be nice if this can make it, but only if it's really ready.


I believe, with Ilya's recent doc fix, it's ready to go.


Let's do it. Many thanks to Ilya and all reviewers! -- Andrei



Re: How to config the GDC on linux target for ARM linux?

2015-12-28 Thread FrankLike via Digitalmars-d-learn

On Monday, 28 December 2015 at 15:23:19 UTC, FrankLike wrote:
 New Answer: I've gotten the answer: use the difference 'gcc' for 
c code.

 ---For x86_64:
 #! /bin/sh
 dfiles="max31855.d max5322.d mcp23008.d mcp23016.d
 mcp23016reg.d mcp23017.d mcp23s08.d mcp23s17.d mcp23x08.d
 mcp23x0817.d mcp3002.d mcp3004.d mcp3422.d mcp4802.d pcf8574.d
 pcf8591.d sn3218.d softPwm.d softServo.d softTone.d sr595.d
 wiringPi.d wiringPiI2C.d wiringPiSPI.d wiringSerial.d
 wiringShift.d wpiExtensions.d"

 ofiles="drcSerial.o max31855.o max5322.o mcp23008.o mcp23016.o
 mcp23017.o mcp23s08.o mcp23s17.o mcp3002.o mcp3004.o mcp3422.o
 mcp4802.o pcf8574.o pcf8591.o piHiPri.o piThread.o sn3218.o
 softPwm.o softServo.o softTone.o sr595.o wiringPi.o
 wiringPiI2C.o wiringPiSPI.o wiringSerial.o wiringShift.o
 wpiExtensions.o"


 gcc -c *.c -m64
 /opt/x86_64-pc-linux-gnu/bin/x86_64-linux-gnu-gdc -o my my.d
 $ofiles -I$dfiles

 For ARM(add -I.):

 #! /bin/sh
 cfiles="wiringPi.c max31855.c max5322.c mcp23008.c mcp23016.c
 mcp23017.c mcp23s08.c mcp23s17.c mcp3002.c mcp3004.c mcp3422.c
 mcp4802.c pcf8574.c pcf8591.c sn3218.c softPwm.c softServo.c
 softTone.c sr595.c  wiringPiI2C.c wiringPiSPI.c wiringSerial.c
 wiringShift.c wpiExtensions.c"

 dfiles="max31855.d max5322.d mcp23008.d mcp23016.d
 mcp23016reg.d mcp23017.d mcp23s08.d mcp23s17.d mcp23x08.d
 mcp23x0817.d mcp3002.d mcp3004.d mcp3422.d mcp4802.d pcf8574.d
 pcf8591.d sn3218.d softPwm.d softServo.d softTone.d sr595.d
 wiringPi.d wiringPiI2C.d wiringPiSPI.d wiringSerial.d
 wiringShift.d wpiExtensions.d"

 ofiles="drcSerial.o max31855.o max5322.o mcp23008.o mcp23016.o
 mcp23017.o mcp23s08.o mcp23s17.o mcp3002.o mcp3004.o mcp3422.o
 mcp4802.o pcf8574.o pcf8591.o piHiPri.o piThread.o sn3218.o
 softPwm.o softServo.o softTone.o sr595.o wiringPi.o
 wiringPiI2C.o wiringPiSPI.o wiringSerial.o wiringShift.o
 wpiExtensions.o"

 
/opt/arm-unknown-linux-gnueabihf/bin/arm-unknown-linux-gnueabihf-gcc -marm  -c $cfiles -I.
 
/opt/arm-unknown-linux-gnueabihf/bin/arm-unknown-linux-gnueabihf-gdc  -o my my.d   $ofiles -I$dfiles





Re: Variable below zero but if statement doesn't grab?

2015-12-28 Thread jkpl via Digitalmars-d-learn

On Monday, 28 December 2015 at 15:50:06 UTC, Basile B. wrote:

On Monday, 28 December 2015 at 15:07:08 UTC, jkpl wrote:

On Sunday, 27 December 2015 at 16:00:34 UTC, jkpl wrote:

On Sunday, 27 December 2015 at 15:53:55 UTC, TheDGuy wrote:

Any idea what i am doing wrong?
https://www.youtube.com/watch?v=j_VCa-5VeP8


You could post the code also, personnaly I'm always almost at 
2 meters from my screen, with zoom, so I can't read the 
code...


I work more or less lying on a futon. Desks are so cheesy...


Anarchism is comfy...


when I'm tired with the conformism I just let my head go on the 
pillow and I sleep...

(snoring)

Even if I dont't think that you have won:
https://youtu.be/Uj_7kTwRMKE?t=2m35s


Re: Voting For std.experimental.ndslice

2015-12-28 Thread Robert burner Schadek via Digitalmars-d
On Monday, 28 December 2015 at 15:52:09 UTC, Robert burner 
Schadek wrote:


fix


Yes: 11
Yes: Conditional: 1 <<-- fix here
No: 0


Please do not merge this with the current state of 
documentation.





Re: Variable below zero but if statement doesn't grab?

2015-12-28 Thread TheDGuy via Digitalmars-d-learn
Get used to it :) Unfortunately, DMD is not emitting the best 
debug information. The program flow is correct, but the line 
info is not, that's why the execution step will not be 
triggered in the real location of the source code.


The simplest example is this:

import std.stdio;

void foo(int x)
{
if (x > 0)  //step 1, correct
{
writeln("bigger");  //step 2, correct
}
else
{
writeln("lower");   //step 3, wrong
}
}

int main(string[] argv)
{
foo(20);   //breakpoint with step in
return 0;
}

If you really want to confuse the debugger, write some asserts 
or contracts here and there and your program will be impossible 
to debug :)


So, do you have any information if there will be a fix to this? 
It is really hard (at least for me) to work with a language which 
doesn't feature a working debugger...


Re: Voting For std.experimental.ndslice

2015-12-28 Thread Andrei Alexandrescu via Digitalmars-d

On 12/28/2015 04:43 PM, Robert burner Schadek wrote:

On Monday, 28 December 2015 at 18:39:47 UTC, Ilya Yaroshenko wrote:

Have you read the latest changes?
http://forum.dlang.org/post/djgkkrdufycyjhpma...@forum.dlang.org



I have.

The problem with the doc is that is describes what it can be used for,
but it does not describe what it is.

It is like saying: "It brings you from point A to point B."
Instead you should say it is a car. And a car is self moving object 

The first few sentences:
"""
The package is designed for applications such as linear algebra, physics
and statistics. It would be well suited to creating machine learning and
image processing algorithms, but should also be general enough for use
anywhere with homogeneously-typed multidimensional data.
"""
does not say what it is.

Should be something, as far as I understand the package, like:

"""
This package provides a multidimensional array implementation, suited
for scientific computing. Additionally, many functions for iteration,
accessing and manipulation are given. 
"""


FWIW I noticed that too. It took me a while to figure what the thing 
really is. -- Andrei


Re: Voting For std.experimental.ndslice

2015-12-28 Thread Ilya Yaroshenko via Digitalmars-d
On Monday, 28 December 2015 at 21:43:35 UTC, Robert burner 
Schadek wrote:
On Monday, 28 December 2015 at 18:39:47 UTC, Ilya Yaroshenko 
wrote:

Have you read the latest changes?
http://forum.dlang.org/post/djgkkrdufycyjhpma...@forum.dlang.org



I have.

The problem with the doc is that is describes what it can be 
used for, but it does not describe what it is.


It is like saying: "It brings you from point A to point B."
Instead you should say it is a car. And a car is self moving 
object 


The first few sentences:
"""
The package is designed for applications such as linear 
algebra, physics and statistics. It would be well suited to 
creating machine learning and image processing algorithms, but 
should also be general enough for use anywhere with 
homogeneously-typed multidimensional data.

"""
does not say what it is.

Should be something, as far as I understand the package, like:

"""
This package provides a multidimensional array implementation, 
suited for scientific computing. Additionally, many functions 
for iteration, accessing and manipulation are given. 

"""


Agreed

1. First paragraph was replaced by your variant.
2. Binary representation was moved to Slice type documentation.
3. Small "Quick Start" was added, so new user will start from 
`sliced` and `Slice`.


http://dtest.thecybershadow.net/artifact/website-76234ca0eab431527327d5ce1ec0ad74c6421533-081dd6e9e8b3810a143d0a5fcba8d60b/web/phobos-prerelease/std_experimental_ndslice.html

Thanks!

Ilya


Re: Better docs for D (WIP)

2015-12-28 Thread Andrei Alexandrescu via Digitalmars-d-announce
One more note: I salute the initiative of another doc generator and read 
the motivation behind it. Yet I do think it's worth asking ourselves two 
questions:


(a) is the new proposed system differentiated enough to justify its 
existence and motivate others to join in?


(b) are the existent systems reaching hard limits that the proposed 
system overcomes by design?


Last thing we want is the idyllic Balkanic landscape of several "me too" 
documentation systems, neither of which is better and has more of a 
following than others.


This is just musing. Please don't make it into Archduke Ferdinand's 
assassination :o).



Andrei


Re: Better docs for D (WIP)

2015-12-28 Thread Andrei Alexandrescu via Digitalmars-d-announce

On 12/28/15 3:15 PM, Adam D. Ruppe wrote:

http://dpldocs.info/

Inspired by the php docs, I also have it able to search direct from a
URL. Click this:

http://dpldocs.info/findSkip


The signature proper is nice. The formatting of "&&" in the constraint 
is inconsistent, but I guess that's a matter with the formatting of the 
code.


The vertical spacing post "Parameters" of http://dpldocs.info/findSkip 
is annoying. So we have a healthy vertical space between the 
"Parameters" and "haystack" headings - fine - then a dinghy space 
between "haystack" and the type, then again a large space between the 
"Type:" and the description.


I think types should be massaged with the parameter names. Also the type 
of the return value should be massaged with the heading "Return Value" 
and the valign of the return value's description should be the same as 
for the parameters, so we have:



Parameters
((vspace 1))
R1 haystack
((hspace 1))The forward range to search in.
((vspace 2))
R2 needle
((hspace 1))The forward range to search for.
((vspace 2))
Return Value (bool)
((vspace 1))
((hspace 1))true if the needle was found, in which case haystack is 
positioned after the end of the first occurrence of needle; otherwise 
false, leaving haystack untouched.



etc.

Ideally most of these things would be adjustable via css. Even some of 
the text (e.g. "Return Value" etc.) would be in a perfect world part of 
the css (there's that property "before" or something).


Essentially it would be fantastic if the docs contained the semantic 
info and the formatting would be entirely shipped to css.



Andrei



Re: Better docs for D (WIP)

2015-12-28 Thread Rikki Cattermole via Digitalmars-d-announce

On 29/12/15 12:05 PM, Andrei Alexandrescu wrote:

One more note: I salute the initiative of another doc generator and read
the motivation behind it. Yet I do think it's worth asking ourselves two
questions:

(a) is the new proposed system differentiated enough to justify its
existence and motivate others to join in?


It supports comments on manifest enums sorta like as if it was named.
The others do not ;)

So I'm already very wanting of this solution to say the least.


Re: Is it possible to elegantly create a range over a binary heap?

2015-12-28 Thread Gary Willoughby via Digitalmars-d-learn

On Monday, 28 December 2015 at 14:05:42 UTC, Ivan Kazmenko wrote:
1. You can find maximum, then second maximum, then third 
maximum and so on - each in constant memory and linear time.  
So, if performance is somehow not an issue, there is a way to 
do it @nogc but in N^2 operations.


That's perhaps too much of a performance hit.

2. If you output the whole array anyway, you may sort the array 
in place.  A sorted array obeys the heap property, so 
subsequent heap operations will still work.


That's actually a good idea. Sort it first, and it should still 
be balanced and correct. Then iteration is easy!


3. The tricky part is when we want to support parallel 
iteration over the same heap.  If we look closely at one 
iteration of heapsort algorithm, it will perhaps become clear 
how to output values so that the array is a heap between any 
two consecutive output operations.  At the very least, our heap 
struct over the array can just track which part of the array is 
already sorted, and work with it separately.


4. Reading and modifying the heap in parallel at the same time 
does not look possible anyway, so this is as far as we can get.


I'll have to test parallel iteration.




Re: Voting For std.experimental.ndslice

2015-12-28 Thread Ilya Yaroshenko via Digitalmars-d
On Monday, 28 December 2015 at 15:52:09 UTC, Robert burner 
Schadek wrote:
On Monday, 28 December 2015 at 07:11:00 UTC, Jack Stouffer 
wrote:

The final tally:

Yes: 12
No: 0


This is not true, my yes was conditional and the documentation 
is still weak. So it is


Yes: 11
Yes: Conditional
No: 0

Please do not merge this with the current state of 
documentation.


Have you read the latest changes?
http://forum.dlang.org/post/djgkkrdufycyjhpma...@forum.dlang.org

I have write documentation as I understand problem. I don't know 
what would be not weak for you. This module has three levels. 
User should study them one by one if he is new be (slice, 
iteration, selection). I am not a book author, I can describe 
something to my colleagues, but I have not any understanding of 
what would be _not weak_.


If you _really_ have  read all documentation one by one with 
attention and you have some question, please write them. Then I 
can improve documentsion.


Ilya


Re: DLanguage IntelliJ plugin released

2015-12-28 Thread Kingsley via Digitalmars-d-announce

On Friday, 25 December 2015 at 17:43:06 UTC, Kingsley wrote:

On Friday, 25 December 2015 at 16:55:32 UTC, Bogdan wrote:
On Friday, 25 December 2015 at 15:28:23 UTC, Pradeep Gowda 
wrote:

On Friday, 25 December 2015 at 15:04:42 UTC, eyveer wrote:
On Friday, 25 December 2015 at 13:57:52 UTC, Pradeep Gowda 
wrote:



[...]


https://github.com/kingsleyh/DLanguage


Thank you. The screenshots are very impressive! Gives me 
motivation to figure out why i couldn't get it to work.


Couldn't figure out what went wrong until I read your comment 
and looked at the screenshots. Try going to Settings/Other 
Tools/D Tools and press all the "Auto Find" buttons.
Raise any issues at the GitHub page and I will fix - I will 
write some documentation over the next few days also


Intellij D plugin version 1.5 released with improved DUB support 
and bug fixes


Re: Variable below zero but if statement doesn't grab?

2015-12-28 Thread jkpl via Digitalmars-d-learn

On Monday, 28 December 2015 at 18:33:16 UTC, jkpl wrote:

On Monday, 28 December 2015 at 18:12:24 UTC, jkpl wrote:

On Monday, 28 December 2015 at 18:02:53 UTC, jkpl wrote:

On Monday, 28 December 2015 at 15:50:06 UTC, Basile B. wrote:

On Monday, 28 December 2015 at 15:07:08 UTC, jkpl wrote:

On Sunday, 27 December 2015 at 16:00:34 UTC, jkpl wrote:

On Sunday, 27 December 2015 at 15:53:55 UTC, TheDGuy wrote:

Any idea what i am doing wrong?
https://www.youtube.com/watch?v=j_VCa-5VeP8


You could post the code also, personnaly I'm always almost 
at 2 meters from my screen, with zoom, so I can't read the 
code...


I work more or less lying on a futon. Desks are so cheesy...


Anarchism is comfy...


when I'm tired with the conformism I just let my head go on 
the pillow and I sleep...

(snoring)

Even if I dont't think that you have won:
https://youtu.be/Uj_7kTwRMKE?t=2m35s


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

tous fashos: juif, chrétien, musulmans,...

Il n'y a bien que les communistes qui ont compris que les 
religions c'est de la merde.


Also, european people should ask themselves why they stick on 
the US culture since 60 years, while actually Russians freed 
Berlin.


One last thing. Tough guy ?

https://www.youtube.com/watch?v=1igvrZ0KosA


Re: Variable below zero but if statement doesn't grab?

2015-12-28 Thread jkpl via Digitalmars-d-learn

On Monday, 28 December 2015 at 18:12:24 UTC, jkpl wrote:

On Monday, 28 December 2015 at 18:02:53 UTC, jkpl wrote:

On Monday, 28 December 2015 at 15:50:06 UTC, Basile B. wrote:

On Monday, 28 December 2015 at 15:07:08 UTC, jkpl wrote:

On Sunday, 27 December 2015 at 16:00:34 UTC, jkpl wrote:

On Sunday, 27 December 2015 at 15:53:55 UTC, TheDGuy wrote:

Any idea what i am doing wrong?
https://www.youtube.com/watch?v=j_VCa-5VeP8


You could post the code also, personnaly I'm always almost 
at 2 meters from my screen, with zoom, so I can't read the 
code...


I work more or less lying on a futon. Desks are so cheesy...


Anarchism is comfy...


when I'm tired with the conformism I just let my head go on 
the pillow and I sleep...

(snoring)

Even if I dont't think that you have won:
https://youtu.be/Uj_7kTwRMKE?t=2m35s


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

tous fashos: juif, chrétien, musulmans,...

Il n'y a bien que les communistes qui ont compris que les 
religions c'est de la merde.


Also, european people should ask themselves why they stick on the 
US culture since 60 years, while actually Russians freed Berlin.


Re: Better watch out! D runs on watchOS!

2015-12-28 Thread Dan Olson via Digitalmars-d-announce
Jacob Carlborg  writes:
>
> Would it be possible to bypass LLVM and do the thread local specific
> parts in LDC?

That is Plan B.2


Re: Article on D for CVu or Overload

2015-12-28 Thread Ali Çehreli via Digitalmars-d

On 12/28/2015 10:14 AM, Jakob Jenkov wrote:

On Monday, 28 December 2015 at 11:40:50 UTC, Russel Winder wrote:

Is anyone up for writing an article or two on D for publication in the
CVu or Overload journals as an act of D-efiance? There are to be a 1-
day D workshop and a keynote session t the conference, it would be
good to "leverage" this as part of the campaign to show that C++ is a
20th century language and D a 21st century one.

I am happy to co-author if that helps. ASCIIDoctor the only source
form usable though.



What would the topics be?

How long?

What are the deadlines?




CVu is for ACCU members only but Overload is freely available online as 
well (both are actually print magazines):


  http://accu.org/index.php/journal

Quoting from the most-recent Overload PDF:

  http://accu.org/index.php/journals/c78/

"All articles intended for publication in Overload 131 should be 
submitted by 1st January 2016 and those for Overload 132 by 1st March 2016."


Ali



Better docs for D (WIP)

2015-12-28 Thread Adam D. Ruppe via Digitalmars-d-announce
Last week, I posted in the general forum my dream for better D 
docs. Today, about 4 days of work later, I'm about 1/4 of the way 
there.


Still a long way to go, but I've already come so far.

First, behold my old dpldocs.info site. Yes, it is still up and 
now it ties into my new docs! You can use it to quickly jump to a 
doc given its name:


http://dpldocs.info/

Inspired by the php docs, I also have it able to search direct 
from a URL. Click this:


http://dpldocs.info/findSkip

and it automatically sends you here:

http://dpldocs.info/experimental-docs/std.algorithm.searching.findSkip.html


I haven't run all of Phobos through my generator yet (it still 
crashes on some of it) but I have run a lot of it through so you 
can browse around and get a feel.



I also described why in This Week in D last night: 
http://arsdnet.net/this-week-in-d/dec-27.html




While I'm still probably at least a month away from having this 
really finished, I feel it is already a massive improvement on 
the main docs and wanted to announce it so other people can give 
it a try too.




Once I finish the generator, I'll start writing new articles to 
fill in some of the dummy links there, and perhaps make minor 
changes to Phobos itself (if I can make changes that help me 
without hurting the existing ddoc based site or source 
legibility). The new articles are a big part of the work too!


Finally, when I am happy with this program, I will document the 
doc generator and release it for other people to use too.


But until then, have fun playing with dpldocs.info!


Re: Better watch out! D runs on watchOS!

2015-12-28 Thread Dan Olson via Digitalmars-d-announce
Joakim  writes:
>
> Thanks for the detailed answer; I'm sure this will now become the
> definitive answer online.  I've gone googling for technical info only
> to sometimes be directed back to a post in these D forums. :)

Me too!  Its very funny when that happens.

> Time to get emulated TLS for Mach-O into llvm, as one google engineer
> did with ELF for Android, which will be released in the upcoming llvm
> 3.8:
>
> https://code.google.com/p/android/issues/detail?id=78122

That is Plan B.1


Re: Variable below zero but if statement doesn't grab?

2015-12-28 Thread jkpl via Digitalmars-d-learn

On Monday, 28 December 2015 at 19:22:00 UTC, jkpl wrote:

On Monday, 28 December 2015 at 18:33:16 UTC, jkpl wrote:

On Monday, 28 December 2015 at 18:12:24 UTC, jkpl wrote:

On Monday, 28 December 2015 at 18:02:53 UTC, jkpl wrote:

On Monday, 28 December 2015 at 15:50:06 UTC, Basile B. wrote:

On Monday, 28 December 2015 at 15:07:08 UTC, jkpl wrote:

On Sunday, 27 December 2015 at 16:00:34 UTC, jkpl wrote:
On Sunday, 27 December 2015 at 15:53:55 UTC, TheDGuy 
wrote:

Any idea what i am doing wrong?
https://www.youtube.com/watch?v=j_VCa-5VeP8


You could post the code also, personnaly I'm always 
almost at 2 meters from my screen, with zoom, so I can't 
read the code...


I work more or less lying on a futon. Desks are so 
cheesy...


Anarchism is comfy...


when I'm tired with the conformism I just let my head go on 
the pillow and I sleep...

(snoring)

Even if I dont't think that you have won:
https://youtu.be/Uj_7kTwRMKE?t=2m35s


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

tous fashos: juif, chrétien, musulmans,...

Il n'y a bien que les communistes qui ont compris que les 
religions c'est de la merde.


Also, european people should ask themselves why they stick on 
the US culture since 60 years, while actually Russians freed 
Berlin.


One last thing. Tough guy ?

https://www.youtube.com/watch?v=1igvrZ0KosA


I always try to find a link to the scene, in south america:

"And finally I've done what I always done...".

I never find it. It's probably because judgment defaits us:

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

We want to show something, but we're always near, no so far, not 
close to our idea.
It exists but we cant find a reference to the perfect 
representation of the idea...




Re: Links to the wiki for Phobos examples/tips and tricks?

2015-12-28 Thread Rikki Cattermole via Digitalmars-d

On 29/12/15 3:23 PM, bachmeier wrote:

Is it acceptable to post examples/tips and tricks in the wiki, and then
link to them in the official Phobos documentation? What I have in mind
is adding to the documentation of a Phobos function

See Also: The [wiki](link) for additional documentation.

This would overcome two (valid IMO) complaints about the current system:

1. There is a lot of overhead associated with changing the official
docs. With the wiki, you type in your new example and you're done. No
futzing around for three hours over a period of several days to make a
small change.
2. Dislike of Ddoc. The wiki uses markdown.

The wiki would accommodate helpful information that is not appropriate
for the official docs:

1. Specialized examples.
2. Tips and tricks.
3. Guidance on choosing between available functions, like benchmarks.

The wiki has advantages over PHP-style user comments. The main one being
that we can do it right now without having to change anything. Another
being the fact that user comments shouldn't be part of the official
docs, because they are unofficial, and are thus wiki material.

So is this something that we can do?


I'm waiting for Andrei to respond but I think we can do one better.

With a little bit of work we could on github ~master push update dlang.org.
So only need somebody to merge PRs or commit changes to ~master and it 
will auto be up there.


Travis-CI would be good for this. Unfortunately I don't know the OS and 
how it is setup let alone have auth rights. But it really shouldn't be 
too much work to do.


Re: Better docs for D (WIP)

2015-12-28 Thread Andrei Alexandrescu via Digitalmars-d-announce
Rikki Cattermole  wrote:
> On 29/12/15 12:05 PM, Andrei Alexandrescu wrote:
>> One more note: I salute the initiative of another doc generator and read
>> the motivation behind it. Yet I do think it's worth asking ourselves two
>> questions:
>> 
>> (a) is the new proposed system differentiated enough to justify its
>> existence and motivate others to join in?
> 
> It supports comments on manifest enums sorta like as if it was named.
> The others do not ;)
> 
> So I'm already very wanting of this solution to say the least.
> 

Is this feature unreasonably difficult to integrate within the existing
products?



Re: Implementing a Programming Language in D: Lexical Analysis

2015-12-28 Thread Ali Çehreli via Digitalmars-d-announce

On 12/28/2015 04:28 PM, Walter Bright wrote:

> 
https://www.reddit.com/r/programming/comments/3ykko7/implementing_a_programming_language_in_d_lexical/


Although the author does not use many D idioms, I've just learned 
(re-learned?) anonymous enums from that code.


I've realized that with a nested anonymous enum, there is no need to 
(and no way of) mentioning the enum type inside a user-defined type. 
This can simplify the implementation:


struct S {
enum { value }

void foo() {
// Look ma, no type:
assert(value == 0);
}
}

void main() {
// Properly name-spaced outside of the struct:
assert(S.value == 0);
}

As can be seen, the users of the struct still have to name-space the 
enum value as S.value. There is no need for an additional enum type for 
example like S.MyEnum.value.


Ali



Re: pl0stuff an optimizing pl0 > c transcompiler

2015-12-28 Thread Nick B via Digitalmars-d-announce

On Tuesday, 29 December 2015 at 00:50:49 UTC, Stefan Koch wrote:



so could it be used to produce D output instead of C ?

Could it be used to parse PHP as input ?


That would probably require implementing a vm.
fancyPars can certainly be used to create a php parser but a 
straightforward translation will not give you good 
performance...


Would you know what is required to get good performance ?



Re: pl0stuff an optimizing pl0 > c transcompiler

2015-12-28 Thread Nick B via Digitalmars-d-announce

On Monday, 28 December 2015 at 16:41:30 UTC, Stefan Koch wrote:

On Monday, 28 December 2015 at 10:45:59 UTC, Nick B wrote:

what languages do you plan to support for input and output ?


I just planned on PL/0 as input and C as output.
It is a simple one-pass (okay 2 pass if you count the 
optimizer) trans-compilation.


There is no middle-end.

And very little verification. Everything that parses will 
produce an c-output.

Which does may or may not compile.

Since PL/0 just one type.
Int

you can get away with anything :)


so could it be used to produce D output instead of C ?

Could it be used to parse PHP as input ?


Poodinis 6.0.0 released

2015-12-28 Thread Mike Bierlee via Digitalmars-d-announce

Poodinis 6.0.0 has been released!

Poodinis is a dependency injection framework for the D 
programming language. It is inspired by the Spring Framework and 
Hypodermic IoC container for C++. Poodinis supports registering 
and resolving classes either by concrete type or interface. 
Automatic injection of dependencies is supported through the use 
of UDAs (Referred to as autowiring).


New in this release:
- Application contexts: Java programmers familiar with the Spring 
Framework should be familiar with application contexts. They 
allow you to set-up complex dependencies through custom defined 
factory methods. Complex dependencies are dependencies which 
require constructor arguments or other sorts of configuration 
before their instances can be used.


You can find the project at:
Github: https://github.com/mbierlee/poodinis
D package registry: http://code.dlang.org/packages/poodinis


Re: pl0stuff an optimizing pl0 > c transcompiler

2015-12-28 Thread Stefan Koch via Digitalmars-d-announce

On Monday, 28 December 2015 at 23:40:31 UTC, Nick B wrote:

On Monday, 28 December 2015 at 16:41:30 UTC, Stefan Koch wrote:

On Monday, 28 December 2015 at 10:45:59 UTC, Nick B wrote:

what languages do you plan to support for input and output ?


I just planned on PL/0 as input and C as output.
It is a simple one-pass (okay 2 pass if you count the 
optimizer) trans-compilation.


There is no middle-end.

And very little verification. Everything that parses will 
produce an c-output.

Which does may or may not compile.

Since PL/0 just one type.
Int

you can get away with anything :)


so could it be used to produce D output instead of C ?

Could it be used to parse PHP as input ?


That would probably require implementing a vm.
fancyPars can certainly be used to create a php parser but a 
straightforward translation will not give you good performance...




Implementing a Programming Language in D: Lexical Analysis

2015-12-28 Thread Walter Bright via Digitalmars-d-announce

http://blog.felixangell.com/implementing-a-programming-language-in-d-part-1/

https://www.reddit.com/r/programming/comments/3ykko7/implementing_a_programming_language_in_d_lexical/

https://news.ycombinator.com/item?id=10802610 (Go through the front page, not 
this link, or your votes won't count)


Re: Voting For std.experimental.ndslice

2015-12-28 Thread Ilya Yaroshenko via Digitalmars-d
On Monday, 28 December 2015 at 22:39:45 UTC, Ilya Yaroshenko 
wrote:
On Monday, 28 December 2015 at 21:43:35 UTC, Robert burner 
Schadek wrote:

[...]


Agreed

1. First paragraph was replaced by your variant.
2. Binary representation was moved to Slice type documentation.
3. Small "Quick Start" was added, so new user will start from 
`sliced` and `Slice`.


http://dtest.thecybershadow.net/artifact/website-76234ca0eab431527327d5ce1ec0ad74c6421533-081dd6e9e8b3810a143d0a5fcba8d60b/web/phobos-prerelease/std_experimental_ndslice.html

Thanks!

Ilya


Fix English: 
http://dtest.thecybershadow.net/artifact/website-76234ca0eab431527327d5ce1ec0ad74c6421533-bfed2500425eb407bf2c97fc72e8a0c5/web/phobos-prerelease/std_experimental_ndslice.html


Re: Implementing a Programming Language in D: Lexical Analysis

2015-12-28 Thread Ali Çehreli via Digitalmars-d-announce

On 12/28/2015 09:57 PM, Ali Çehreli wrote:

> anonymous enums

Wow! They are pretty weird:

1) The second form of the AnonymousEnumDeclaration spec is redundant, right?

  http://dlang.org/spec/enum.html#AnonymousEnumDeclaration

enum : EnumBaseType { EnumMembers }
enum { EnumMembers }<-- Redundant?
enum { AnonymousEnumMembers }

The reason is, AnonymousEnumMembers already covers EnumMembers, no?

2) Anonymous enum definitions can have types right inside the list:

AnonymousEnumMember:
EnumMember
Type Identifier = AssignExpression

enum {
a,
ulong b = 42, c,   // b and c are ulong
s = "hello",   // an inferred string between integrals!
x = 7, y, z
}

3) The types of x, y, and z are 'int' because 7 is an int (they don't 
follow the type of 'c'). However, move 's' to the end of the list or 
remove it altogether, then x, y, and z become ulong! Weird. Ok, I'm 
going to forget about this feature now. :p


Ali