Re: Help me decide D or C

2019-07-31 Thread Bert via Digitalmars-d-learn
On Wednesday, 31 July 2019 at 18:38:02 UTC, Alexandre wrote: Hi everyone, I would like an honest opinion. I have a beginner level (able to do very small programs) in a few languages such as python, go, C, guile(scheme) and common lisp. I want to pick a language and go deep with it and focus

Re: Example uses "volatile"; compiler says "undefined identifier volatile"

2019-07-31 Thread Timo Sintonen via Digitalmars-d-learn
On Thursday, 1 August 2019 at 03:04:27 UTC, Paul wrote: I'm trying to build a Bare Bones 'OS' via example. Example says to compile with "gdc -c kernel.main.d -o kernel.main.o -g" I'm having trouble getting GDC all set up..as I'm a rank amateur. So, I tried compiling the example below with

Re: Help me decide D or C

2019-07-31 Thread rikki cattermole via Digitalmars-d-learn
Whatever direction you choose to go, you should have a good community available to help you out. For D there is the Discord (or IRC, but I think Discord would be more suited to you) https://discord.gg/3vFMag7 And there is a Facebook group which I'm apart of which is decent (caters to all

Example uses "volatile"; compiler says "undefined identifier volatile"

2019-07-31 Thread Paul via Digitalmars-d-learn
I'm trying to build a Bare Bones 'OS' via example. Example says to compile with "gdc -c kernel.main.d -o kernel.main.o -g" I'm having trouble getting GDC all set up..as I'm a rank amateur. So, I tried compiling the example below with DMD. DMD spits out exceptions to the use of 'volatile'.

Re: Help me decide D or C

2019-07-31 Thread SashaGreat via Digitalmars-d-learn
On Wednesday, 31 July 2019 at 23:11:35 UTC, bachmeier wrote: I've been writing D code for six years. Someone that has programmed before could work through Adam's cookbook or Mike's book easily. About Mike's book, you're talking about this one:

Re: Is there a way to adjust lookup paths for modules during compilation?

2019-07-31 Thread H. S. Teoh via Digitalmars-d-learn
On Wed, Jul 31, 2019 at 08:47:42PM +, Andrey Zherikov via Digitalmars-d-learn wrote: > On Wednesday, 31 July 2019 at 20:16:01 UTC, H. S. Teoh wrote: > > On Wed, Jul 31, 2019 at 08:09:29PM +, Andrey Zherikov via > > Digitalmars-d-learn wrote: > > > I found a function that seems could be

Re: Help me decide D or C

2019-07-31 Thread bachmeier via Digitalmars-d-learn
On Wednesday, 31 July 2019 at 22:49:10 UTC, SashaGreat wrote: On Wednesday, 31 July 2019 at 22:16:42 UTC, bachmeier wrote: What is your goal? In my opinion, learning C is a waste of time in 2019 unless you have something specific in mind related to a job. C is mostly "fun with segmentation

Re: Help me decide D or C

2019-07-31 Thread SashaGreat via Digitalmars-d-learn
On Wednesday, 31 July 2019 at 22:16:42 UTC, bachmeier wrote: What is your goal? In my opinion, learning C is a waste of time in 2019 unless you have something specific in mind related to a job. C is mostly "fun with segmentation faults". Most of your time is not spent solving problems. If you

Re: Help me decide D or C

2019-07-31 Thread Alexandre via Digitalmars-d-learn
On Wednesday, 31 July 2019 at 20:04:39 UTC, Ali Çehreli wrote: n 07/31/2019 12:05 PM, Paul Backus wrote: > I would not recommend D as a beginning language, both because there are > fewer beginner-oriented resources available for it than for C and Python > (the only one I know of is Ali

Re: Help me decide D or C

2019-07-31 Thread Alexandre via Digitalmars-d-learn
On Wednesday, 31 July 2019 at 22:16:42 UTC, bachmeier wrote: On Wednesday, 31 July 2019 at 18:38:02 UTC, Alexandre wrote: [...] What is your goal? In my opinion, learning C is a waste of time in 2019 unless you have something specific in mind related to a job. C is mostly "fun with

Re: Help me decide D or C

2019-07-31 Thread bachmeier via Digitalmars-d-learn
On Wednesday, 31 July 2019 at 18:38:02 UTC, Alexandre wrote: Hi everyone, I would like an honest opinion. I have a beginner level (able to do very small programs) in a few languages such as python, go, C, guile(scheme) and common lisp. I want to pick a language and go deep with it and focus

Re: How do I display unicode characters in D on standard (english) Windows 10 console window?

2019-07-31 Thread Carl Sturtivant via Digitalmars-d-learn
On Monday, 29 July 2019 at 22:17:55 UTC, WhatMeWorry wrote: This is a very stupid question but from Ali's book, I took this segment: writeln("Résumé preparation: 10.25€"); writeln("\x52\sum\u00e9 preparation: 10.25\"); and after running it all I get is the following: R├⌐sum├⌐ preparation:

Re: Help me decide D or C

2019-07-31 Thread matheus via Digitalmars-d-learn
On Wednesday, 31 July 2019 at 18:38:02 UTC, Alexandre wrote: ... Should I go for C and then when I become a better programmer change to D? Should I start with D right now? ... I think it depend your intent, but right now for a beginner between C and D I would go with C, because as you noted

Re: Is there a way to adjust lookup paths for modules during compilation?

2019-07-31 Thread Andrey Zherikov via Digitalmars-d-learn
On Wednesday, 31 July 2019 at 20:16:01 UTC, H. S. Teoh wrote: On Wed, Jul 31, 2019 at 08:09:29PM +, Andrey Zherikov via Digitalmars-d-learn wrote: I found a function that seems could be used for adding import paths: dmd.frontend.addImport

Re: Is there a way to adjust lookup paths for modules during compilation?

2019-07-31 Thread Andre Pany via Digitalmars-d-learn
On Wednesday, 31 July 2019 at 20:25:44 UTC, Ali Çehreli wrote: On 07/31/2019 10:29 AM, Andrey Zherikov wrote: I want my program to add some directories into module lookup process (like adding -I dmd options). List of directories is known at compile time but the choice of what exact directories

Re: Meaning of Scoped! ??

2019-07-31 Thread Ali Çehreli via Digitalmars-d-learn
On 07/30/2019 02:33 AM, Ron Tarrant wrote: > With contemporary search engines, it's impossible to search for '!' and > get meaningful results. I recommend this Index section for such cases: http://ddili.org/ders/d.en/ix.html Like most of Phobos, Scoped is not there but the "!, template

Re: Is there a way to adjust lookup paths for modules during compilation?

2019-07-31 Thread Ali Çehreli via Digitalmars-d-learn
On 07/31/2019 10:29 AM, Andrey Zherikov wrote: I want my program to add some directories into module lookup process (like adding -I dmd options). List of directories is known at compile time but the choice of what exact directories to add depends on `-version` parameter. Is there a way to

Re: How to setup D language with Apache httpd cgi?

2019-07-31 Thread Andre Pany via Digitalmars-d-learn
On Wednesday, 31 July 2019 at 17:04:58 UTC, BoQsc wrote: However I tried to add options (--single) to the dub shebang and apache now throwing: "bad header error" Without "--single" option seems to work. #!/usr/bin/env -vS dub --single /+ dub.sdl: name "application" dependency

Re: Is there a way to adjust lookup paths for modules during compilation?

2019-07-31 Thread H. S. Teoh via Digitalmars-d-learn
On Wed, Jul 31, 2019 at 08:09:29PM +, Andrey Zherikov via Digitalmars-d-learn wrote: > I found a function that seems could be used for adding import paths: > dmd.frontend.addImport > (https://dlang.org/phobos/dmd_frontend.html#.addImport). But it's not clear > how can I use it: dmd directory

Re: Is there a way to adjust lookup paths for modules during compilation?

2019-07-31 Thread Andrey Zherikov via Digitalmars-d-learn
I found a function that seems could be used for adding import paths: dmd.frontend.addImport (https://dlang.org/phobos/dmd_frontend.html#.addImport). But it's not clear how can I use it: dmd directory is not added to lookup by default and trying adding it gives errors: dmd.exe -i

Re: opEquals when your type occurs on the right hand side of an equality test

2019-07-31 Thread Ali Çehreli via Digitalmars-d-learn
On 07/31/2019 01:03 PM, NonNull wrote: I am creating a specialized bit pattern (secretly represented as a uint) as a struct S, but want to avoid `alias this` to maintain encapsulation excepting where I overtly say. Specifically, I want to avoid making arithmetic and inequalities available for

Re: Help me decide D or C

2019-07-31 Thread Ali Çehreli via Digitalmars-d-learn
n 07/31/2019 12:05 PM, Paul Backus wrote: > I would not recommend D as a beginning language, both because there are > fewer beginner-oriented resources available for it than for C and Python > (the only one I know of is Ali Çehreli's book [1]), and because it's a > bigger, more complicated

opEquals when your type occurs on the right hand side of an equality test

2019-07-31 Thread NonNull via Digitalmars-d-learn
I am creating a specialized bit pattern (secretly represented as a uint) as a struct S, but want to avoid `alias this` to maintain encapsulation excepting where I overtly say. Specifically, I want to avoid making arithmetic and inequalities available for S. I have written opEquals to compare

Re: Help me decide D or C

2019-07-31 Thread Paul Backus via Digitalmars-d-learn
On Wednesday, 31 July 2019 at 18:38:02 UTC, Alexandre wrote: Hi everyone, I would like an honest opinion. I have a beginner level (able to do very small programs) in a few languages such as python, go, C, guile(scheme) and common lisp. I want to pick a language and go deep with it and focus

Re: Help me decide D or C

2019-07-31 Thread Andre Pany via Digitalmars-d-learn
On Wednesday, 31 July 2019 at 18:38:02 UTC, Alexandre wrote: Hi everyone, I would like an honest opinion. I have a beginner level (able to do very small programs) in a few languages such as python, go, C, guile(scheme) and common lisp. I want to pick a language and go deep with it and focus

Help me decide D or C

2019-07-31 Thread Alexandre via Digitalmars-d-learn
Hi everyone, I would like an honest opinion. I have a beginner level (able to do very small programs) in a few languages such as python, go, C, guile(scheme) and common lisp. I want to pick a language and go deep with it and focus on only one for at least the next 2 years or so. Should I

Re: Is there a way to adjust lookup paths for modules during compilation?

2019-07-31 Thread Andrey Zherikov via Digitalmars-d-learn
On Wednesday, 31 July 2019 at 17:59:00 UTC, bauss wrote: Your best bet is actually not relying on CTFE since IO is very restricted at CTFE in D. Ex. you can only import files that are specified by you. The best thing you can do is have a file that lists every file you need to be able to read

Re: Is there a way to adjust lookup paths for modules during compilation?

2019-07-31 Thread bauss via Digitalmars-d-learn
On Wednesday, 31 July 2019 at 17:29:58 UTC, Andrey Zherikov wrote: I want my program to add some directories into module lookup process (like adding -I dmd options). List of directories is known at compile time but the choice of what exact directories to add depends on `-version` parameter.

Is there a way to adjust lookup paths for modules during compilation?

2019-07-31 Thread Andrey Zherikov via Digitalmars-d-learn
I want my program to add some directories into module lookup process (like adding -I dmd options). List of directories is known at compile time but the choice of what exact directories to add depends on `-version` parameter. Is there a way to achieve this in code? I can actually do this by

Re: How to setup D language with Apache httpd cgi?

2019-07-31 Thread H. S. Teoh via Digitalmars-d-learn
On Wed, Jul 31, 2019 at 05:09:50PM +, BoQsc via Digitalmars-d-learn wrote: [...] > However as pointed out in the above post, I'm unable to use options in > shebang since apache is throwing header error for unknown reasons. [...] Usually, that's a sign that somebody is writing to stdout/stderr

Re: How to setup D language with Apache httpd cgi?

2019-07-31 Thread BoQsc via Digitalmars-d-learn
On Wednesday, 31 July 2019 at 14:19:20 UTC, bachmeier wrote: is going to compile every time it runs, which makes the program unnecessarily slow If only I could add dub --single --rdmd to the shebang, I think dub might stop compiling every time. However as pointed out in the above post, I'm

Re: How to setup D language with Apache httpd cgi?

2019-07-31 Thread BoQsc via Digitalmars-d-learn
However I tried to add options (--single) to the dub shebang and apache now throwing: "bad header error" Without "--single" option seems to work. #!/usr/bin/env -vS dub --single /+ dub.sdl: name "application" dependency "arsd-official:dom" version="4.0.2" +/ import std.stdio; import

Re: How to setup D language with Apache httpd cgi?

2019-07-31 Thread BoQsc via Digitalmars-d-learn
is going to compile every time it runs, which makes the program unnecessarily slow, and if it's used heavily, will add quite a load to the server. I finally done it, and I'm not sure if it compiles every time. It opens the page lightning fast since I use SSD drive. I'm not sure how to check

Re: How to setup D language with Apache httpd cgi?

2019-07-31 Thread bachmeier via Digitalmars-d-learn
On Wednesday, 31 July 2019 at 07:19:12 UTC, BoQsc wrote: There are some other bad news, I switched from rdmd to dub package manager since I need a package from Adam D. Ruppe. It is all good and well: this one works perfectly. #!/usr/bin/env dub /+ dub.sdl: name "hello" +/

Re: How to setup D language with Apache httpd cgi?

2019-07-31 Thread Andre Pany via Digitalmars-d-learn
On Wednesday, 31 July 2019 at 12:51:09 UTC, Adam D. Ruppe wrote: On Wednesday, 31 July 2019 at 09:09:12 UTC, BoQsc wrote: dependency "arsd-official" version="~>4.0.1" I just changed the thing, so now you will want to use version 4.0.2 and also require the cgi configuration rather

Re: How to setup D language with Apache httpd cgi?

2019-07-31 Thread BoQsc via Digitalmars-d-learn
Hmm, it seems that once I remove sudo from the shebang, the error disappears and Internal Server Error disappears. example.d - does not work #!/usr/bin/env -S sudo dub /+ dub.sdl: name "hello" +/ import std.stdio; void main() { writeln(`Content-type: text/html`);

Re: How to setup D language with Apache httpd cgi?

2019-07-31 Thread Adam D. Ruppe via Digitalmars-d-learn
On Wednesday, 31 July 2019 at 09:09:12 UTC, BoQsc wrote: dependency "arsd-official" version="~>4.0.1" I just changed the thing, so now you will want to use version 4.0.2 and also require the cgi configuration rather than the default (I don't know how to do that in dub). Though

Re: How to setup D language with Apache httpd cgi?

2019-07-31 Thread Andre Pany via Digitalmars-d-learn
On Wednesday, 31 July 2019 at 10:24:38 UTC, BoQsc wrote: On Wednesday, 31 July 2019 at 09:09:12 UTC, BoQsc wrote: On Wednesday, 31 July 2019 at 09:03:47 UTC, BoQsc wrote: And this is the error I get now: [Wed Jul 31 11:51:15.341790 2019] [cgid:error] [pid 870:tid 140153708345088] [client

Re: How to setup D language with Apache httpd cgi?

2019-07-31 Thread Andre Pany via Digitalmars-d-learn
On Wednesday, 31 July 2019 at 10:24:38 UTC, BoQsc wrote: On Wednesday, 31 July 2019 at 09:09:12 UTC, BoQsc wrote: On Wednesday, 31 July 2019 at 09:03:47 UTC, BoQsc wrote: And this is the error I get now: [Wed Jul 31 11:51:15.341790 2019] [cgid:error] [pid 870:tid 140153708345088] [client

Re: How to setup D language with Apache httpd cgi?

2019-07-31 Thread BoQsc via Digitalmars-d-learn
On Wednesday, 31 July 2019 at 09:09:12 UTC, BoQsc wrote: On Wednesday, 31 July 2019 at 09:03:47 UTC, BoQsc wrote: And this is the error I get now: [Wed Jul 31 11:51:15.341790 2019] [cgid:error] [pid 870:tid 140153708345088] [client >127.0.0.1:50318] End of script output before headers:

Re: How to setup D language with Apache httpd cgi?

2019-07-31 Thread BoQsc via Digitalmars-d-learn
On Wednesday, 31 July 2019 at 09:03:47 UTC, BoQsc wrote: And this is the error I get now: [Wed Jul 31 11:51:15.341790 2019] [cgid:error] [pid 870:tid 140153708345088] [client >127.0.0.1:50318] End of script output before headers: example.d And I have no idea how to deal with it. Cgi shows

Re: How to setup D language with Apache httpd cgi?

2019-07-31 Thread BoQsc via Digitalmars-d-learn
On Wednesday, 31 July 2019 at 08:32:43 UTC, BoQsc wrote: Added sudo to the shebang, it started to say that sudo requires tty, meaning that there is no graphical interface for user to input the password. So, I remove the need to type password when using sudo command, by following these

Re: How to setup D language with Apache httpd cgi?

2019-07-31 Thread BoQsc via Digitalmars-d-learn
On Wednesday, 31 July 2019 at 07:57:01 UTC, BoQsc wrote: [Wed Jul 31 10:44:26.887024 2019] [cgid:error] [pid 846:tid 140090256426752] [client >127.0.0.1:57052] malformed header from script 'example.d': Bad header: Fetching arsd-official 4.0.1 ( /usr/lib/cgi-bin/.dub/packages/: Permission

Re: How to setup D language with Apache httpd cgi?

2019-07-31 Thread BoQsc via Digitalmars-d-learn
On Wednesday, 31 July 2019 at 07:42:22 UTC, BoQsc wrote: This seems to work well when running not from cgi, so there is That was not true, it didn't work even from Linux Shell, I corrected shebang, now it works from Linux Shell. An, unexpected thing: It did require permissions: sudo

Re: How to setup D language with Apache httpd cgi?

2019-07-31 Thread BoQsc via Digitalmars-d-learn
This seems to work well when running not from cgi, so there is That was not true, it didn't work even from Linux Shell, I corrected shebang, now it works from Linux Shell. An, unexpected thing: It did require permissions: sudo ./example.d which was not the case with rdmd. cgi still shows

Re: How to setup D language with Apache httpd cgi?

2019-07-31 Thread BoQsc via Digitalmars-d-learn
I tried to change shebang, but: Internal Server Error still appears. #!/usr/bin/env dub run --single /+ dub.sdl: name "hello" dependency "arsd-official" version="~>4.0.1" +/ import std.stdio; void main() { writeln(`Content-type: text/html`); writeln(``);

Re: How to setup D language with Apache httpd cgi?

2019-07-31 Thread BoQsc via Digitalmars-d-learn
There are some other bad news, I switched from rdmd to dub package manager since I need a package from Adam D. Ruppe. It is all good and well: this one works perfectly. #!/usr/bin/env dub /+ dub.sdl: name "hello" +/ import std.stdio; void main() { writeln(`Content-type:

Re: How to setup D language with Apache httpd cgi?

2019-07-31 Thread BoQsc via Digitalmars-d-learn
On Wednesday, 31 July 2019 at 06:52:46 UTC, 0xEAB wrote: On Wednesday, 31 July 2019 at 06:30:03 UTC, BoQsc wrote: This can be solved by using single quotes in the argument content places #!/usr/bin/env rdmd import std.stdio; void main() { writeln("Content-type: text/html"); writeln("");

Re: How to setup D language with Apache httpd cgi?

2019-07-31 Thread BoQsc via Digitalmars-d-learn
On Wednesday, 31 July 2019 at 06:55:06 UTC, 0xEAB wrote: On Wednesday, 31 July 2019 at 06:30:03 UTC, BoQsc wrote: On Wednesday, 31 July 2019 at 05:56:46 UTC, BoQsc wrote: what causes the Internal Server Error. Internal Server Error might as well appear when D language syntax is not correct.

Re: How to setup D language with Apache httpd cgi?

2019-07-31 Thread 0xEAB via Digitalmars-d-learn
On Wednesday, 31 July 2019 at 06:30:03 UTC, BoQsc wrote: On Wednesday, 31 July 2019 at 05:56:46 UTC, BoQsc wrote: what causes the Internal Server Error. Internal Server Error might as well appear when D language syntax is not correct. Maybe you want to use some wrapper around rdmd that

Re: How to setup D language with Apache httpd cgi?

2019-07-31 Thread 0xEAB via Digitalmars-d-learn
On Wednesday, 31 July 2019 at 06:30:03 UTC, BoQsc wrote: This can be solved by using single quotes in the argument content places #!/usr/bin/env rdmd import std.stdio; void main() { writeln("Content-type: text/html"); writeln(""); writeln("CGI D Example"); } Does the job but is a

Re: How to setup D language with Apache httpd cgi?

2019-07-31 Thread BoQsc via Digitalmars-d-learn
On Wednesday, 31 July 2019 at 05:56:46 UTC, BoQsc wrote: what causes the Internal Server Error. Internal Server Error might as well appear when D language syntax is not correct. Considering this: this example has Internal Server Error, since writeln argument and argument content cannot

Re: How to setup D language with Apache httpd cgi?

2019-07-31 Thread BoQsc via Digitalmars-d-learn
On Tuesday, 30 July 2019 at 21:55:00 UTC, Adam D. Ruppe wrote: the required blank line to separate headers from content. That's exactly what causes the Internal Server Error. This is a working example.d #!/usr/bin/env rdmd import std.stdio; void main() { writeln(""); } And this one,