Re: Compile time executable calling?

2014-01-19 Thread Jacob Carlborg
On 2014-01-09 00:16, H. S. Teoh wrote: offtopic rant A *shell script* could do better than make, by actually making sure that everything is recompiled and up-to-date I use a shell script for most of my projects. It's usually a one line shell script, just to not have to retype all flags every

Compile time executable calling?

2014-01-08 Thread Tofu Ninja
I made a post about it a few months back and it seemed like there were some people who would want this, but nothing ever came of it. The idea is basically being able to call and capture the output of a program at compile time, similar to a string import. Has anyone thought about this since?

Re: Compile time executable calling?

2014-01-08 Thread Orvid King
On Wednesday, 8 January 2014 at 18:46:37 UTC, Tofu Ninja wrote: I made a post about it a few months back and it seemed like there were some people who would want this, but nothing ever came of it. The idea is basically being able to call and capture the output of a program at compile time,

Re: Compile time executable calling?

2014-01-08 Thread Tofu Ninja
On Wednesday, 8 January 2014 at 18:50:04 UTC, Orvid King wrote: On Wednesday, 8 January 2014 at 18:46:37 UTC, Tofu Ninja wrote: I made a post about it a few months back and it seemed like there were some people who would want this, but nothing ever came of it. The idea is basically being

Re: Compile time executable calling?

2014-01-08 Thread H. S. Teoh
On Wed, Jan 08, 2014 at 06:56:26PM +, Tofu Ninja wrote: On Wednesday, 8 January 2014 at 18:50:04 UTC, Orvid King wrote: On Wednesday, 8 January 2014 at 18:46:37 UTC, Tofu Ninja wrote: I made a post about it a few months back and it seemed like there were some people who would want this,

Re: Compile time executable calling?

2014-01-08 Thread Tofu Ninja
On Wednesday, 8 January 2014 at 20:34:20 UTC, H. S. Teoh wrote: On Wed, Jan 08, 2014 at 06:56:26PM +, Tofu Ninja wrote: On Wednesday, 8 January 2014 at 18:50:04 UTC, Orvid King wrote: On Wednesday, 8 January 2014 at 18:46:37 UTC, Tofu Ninja wrote: I made a post about it a few months back

Re: Compile time executable calling?

2014-01-08 Thread Brian Schott
Just make your makefile run the script, pipe its output to a file, and do a string import of the generated file.

Re: Compile time executable calling?

2014-01-08 Thread Tofu Ninja
On Wednesday, 8 January 2014 at 22:01:56 UTC, Brian Schott wrote: Just make your makefile run the script, pipe its output to a file, and do a string import of the generated file. The kind of stuff I want to use it for would make that tactic tedious and error prone. I would use it like how

Re: Compile time executable calling?

2014-01-08 Thread H. S. Teoh
On Wed, Jan 08, 2014 at 10:29:03PM +, Tofu Ninja wrote: On Wednesday, 8 January 2014 at 22:01:56 UTC, Brian Schott wrote: Just make your makefile run the script, pipe its output to a file, and do a string import of the generated file. The kind of stuff I want to use it for would make

Re: Compile time executable calling?

2014-01-08 Thread Tofu Ninja
On Wednesday, 8 January 2014 at 23:17:48 UTC, H. S. Teoh wrote: On Wed, Jan 08, 2014 at 10:29:03PM +, Tofu Ninja wrote: On Wednesday, 8 January 2014 at 22:01:56 UTC, Brian Schott wrote: Just make your makefile run the script, pipe its output to a file, and do a string import of the

Re: Compile time executable calling?

2014-01-08 Thread H. S. Teoh
On Wed, Jan 08, 2014 at 11:55:38PM +, Tofu Ninja wrote: [...] I didn't just mean keeping it in sync with the source files, but in sync with every instance of the external exe call that might happen, and since I would want to use it like how ctfe is used that basically means any time I

Re: Compile time executable calling?

2013-07-18 Thread Jacob Carlborg
On 2013-07-18 00:15, H. S. Teoh wrote: Wow. That sounds like it's still a long ways off. But at least we're making progress. Oh, forgot to mention. There are several other people here that are working on implementing a D front end. These are mostly lexers. There's one in the review queue,

Re: Compile time executable calling?

2013-07-17 Thread Jacob Carlborg
On 2013-07-16 06:10, Andrei Alexandrescu wrote: I think the right direction here is to factor compiler parts as a library. Yes, I agree. I've been wanting this for a long time. -- /Jacob Carlborg

Re: Compile time executable calling?

2013-07-17 Thread H. S. Teoh
On Wed, Jul 17, 2013 at 10:34:32AM +0200, Jacob Carlborg wrote: On 2013-07-16 06:10, Andrei Alexandrescu wrote: I think the right direction here is to factor compiler parts as a library. Yes, I agree. I've been wanting this for a long time. [...] We've been talking about this for a while.

Re: Compile time executable calling?

2013-07-17 Thread Jacob Carlborg
On 2013-07-17 16:55, H. S. Teoh wrote: We've been talking about this for a while. Have we made any progress in this direction since? There's been a bunch of pull requests merged related to adopting the DMD source code to make it work with the tool, I think it was, Daniel Murphy has created.

Re: Compile time executable calling?

2013-07-17 Thread H. S. Teoh
On Wed, Jul 17, 2013 at 05:40:03PM +0200, Jacob Carlborg wrote: On 2013-07-17 16:55, H. S. Teoh wrote: We've been talking about this for a while. Have we made any progress in this direction since? There's been a bunch of pull requests merged related to adopting the DMD source code to make

Re: Compile time executable calling?

2013-07-17 Thread Tofu Ninja
So if some one were to implement this, any ideas on the preferred syntax for such a feature?

Re: Compile time executable calling?

2013-07-16 Thread Timothee Cour
On Mon, Jul 15, 2013 at 9:10 PM, Andrei Alexandrescu seewebsiteforem...@erdani.org wrote: On 7/15/13 6:26 AM, Don wrote: On Friday, 12 July 2013 at 20:42:50 UTC, Tofu Ninja wrote: So I had an idea recently, wouldn't it be cool to have the ability to call an executable at compile time and

Re: Compile time executable calling?

2013-07-15 Thread Don
On Friday, 12 July 2013 at 20:42:50 UTC, Tofu Ninja wrote: So I had an idea recently, wouldn't it be cool to have the ability to call an executable at compile time and capture its output. Something like the string imports but instead of opening and reading a text file, it run an executable,

Re: Compile time executable calling?

2013-07-15 Thread Tofu Ninja
On Monday, 15 July 2013 at 13:26:13 UTC, Don wrote: On Friday, 12 July 2013 at 20:42:50 UTC, Tofu Ninja wrote: So I had an idea recently, wouldn't it be cool to have the ability to call an executable at compile time and capture its output. Something like the string imports but instead of

Re: Compile time executable calling?

2013-07-15 Thread Peter Alexander
a feature that is easy to misuse then it WILL be misused. Just looks at macros in C. Any program that uses compile time executable calling will almost certainly become non-portable. This is not a good thing.

Re: Compile time executable calling?

2013-07-15 Thread Ali Çehreli
On 07/13/2013 09:05 AM, Ary Borenszweig wrote: What would actually be cool is to run any kind of code at compile time (within a sandbox, if you want). For example reading a mysql database and generating classes for the tables at compile time. No need to run a separate executable and remember

Re: Compile time executable calling?

2013-07-15 Thread Ary Borenszweig
On 7/15/13 2:03 PM, Ali Çehreli wrote: On 07/13/2013 09:05 AM, Ary Borenszweig wrote: What would actually be cool is to run any kind of code at compile time (within a sandbox, if you want). For example reading a mysql database and generating classes for the tables at compile time. No need

Re: Compile time executable calling?

2013-07-15 Thread Ali Çehreli
On 07/15/2013 08:05 AM, Tofu Ninja wrote: We should be as flexible as possible and leave the decision up to the programmer. We shouldn't restrict a feature based on a fictional idea of purity or vague worry of feature bloat(as others have mentioned) My worry is not vague at all. What stops

Re: Compile time executable calling?

2013-07-15 Thread H. S. Teoh
On Mon, Jul 15, 2013 at 02:06:47PM -0300, Ary Borenszweig wrote: On 7/15/13 2:03 PM, Ali Çehreli wrote: On 07/13/2013 09:05 AM, Ary Borenszweig wrote: What would actually be cool is to run any kind of code at compile time (within a sandbox, if you want). For example reading a mysql

Re: Compile time executable calling?

2013-07-15 Thread Tofu Ninja
On Monday, 15 July 2013 at 17:08:48 UTC, Ali Çehreli wrote: On 07/15/2013 08:05 AM, Tofu Ninja wrote: We should be as flexible as possible and leave the decision up to the programmer. We shouldn't restrict a feature based on a fictional idea of purity or vague worry of feature bloat(as

Re: Compile time executable calling?

2013-07-15 Thread H. S. Teoh
On Mon, Jul 15, 2013 at 07:35:44PM +0200, Tofu Ninja wrote: [...] The use cases I am more interested in are not possible with make. Having the ability to pass the arguments from within the language itself allows you to define your use cases inline instead of having to separately define the use

Re: Compile time executable calling?

2013-07-15 Thread Timothee Cour
On Mon, Jul 15, 2013 at 10:35 AM, Tofu Ninja emmo...@purdue.edu wrote: On Monday, 15 July 2013 at 17:08:48 UTC, Ali Çehreli wrote: On 07/15/2013 08:05 AM, Tofu Ninja wrote: We should be as flexible as possible and leave the decision up to the programmer. We shouldn't restrict a feature

Re: Compile time executable calling?

2013-07-15 Thread Tofu Ninja
On Monday, 15 July 2013 at 17:49:04 UTC, H. S. Teoh wrote: On Mon, Jul 15, 2013 at 07:35:44PM +0200, Tofu Ninja wrote: [...] The use cases I am more interested in are not possible with make. Having the ability to pass the arguments from within the language itself allows you to define your use

Re: Compile time executable calling?

2013-07-15 Thread H. S. Teoh
On Mon, Jul 15, 2013 at 07:54:56PM +0200, Tofu Ninja wrote: On Monday, 15 July 2013 at 17:49:04 UTC, H. S. Teoh wrote: On Mon, Jul 15, 2013 at 07:35:44PM +0200, Tofu Ninja wrote: [...] The use cases I am more interested in are not possible with make. Having the ability to pass the arguments

Re: Compile time executable calling?

2013-07-15 Thread Andrei Alexandrescu
On 7/15/13 6:26 AM, Don wrote: On Friday, 12 July 2013 at 20:42:50 UTC, Tofu Ninja wrote: So I had an idea recently, wouldn't it be cool to have the ability to call an executable at compile time and capture its output. Something like the string imports but instead of opening and reading a text

Re: Compile time executable calling?

2013-07-15 Thread deadalnix
On Friday, 12 July 2013 at 21:54:02 UTC, Walter Bright wrote: On 7/12/2013 1:42 PM, Tofu Ninja wrote: So I had an idea recently, wouldn't it be cool to have the ability to call an executable at compile time and capture its output. Something like the string imports but instead of opening and

Re: Compile time executable calling?

2013-07-15 Thread deadalnix
On Tuesday, 16 July 2013 at 04:10:35 UTC, Andrei Alexandrescu wrote: I think the right direction here is to factor compiler parts as a library. Then user code may insert external artifacts (notably REPL) on its own. Andrei SDC is already based on that principle, but still far from release

Re: Compile time executable calling?

2013-07-14 Thread Timothee Cour
On Fri, Jul 12, 2013 at 9:23 PM, Walter Bright newshou...@digitalmars.comwrote: On 7/12/2013 5:00 PM, Timothee Cour wrote: Let's put it another way: if I or someone else made a pull request for CTFE exec, would it have a chance of being accepted? A big problem with it would be the

Re: Compile time executable calling?

2013-07-14 Thread Timothee Cour
On Sat, Jul 13, 2013 at 9:05 AM, Ary Borenszweig a...@esperanto.org.arwrote: On 7/12/13 5:42 PM, Tofu Ninja wrote: So I had an idea recently, wouldn't it be cool to have the ability to call an executable at compile time and capture its output. Something like the string imports but instead of

Re: Compile time executable calling?

2013-07-13 Thread BLM768
On Saturday, 13 July 2013 at 04:23:56 UTC, Walter Bright wrote: A big problem with it would be the equivalent of the SQL Injection Exploit. Since the compiler can now execute arbitrary code, someone passing around malicious source code could do anything to your system. Assuming that the

Re: Compile time executable calling?

2013-07-13 Thread Walter Bright
On 7/12/2013 11:52 PM, BLM768 wrote: On Saturday, 13 July 2013 at 04:23:56 UTC, Walter Bright wrote: A big problem with it would be the equivalent of the SQL Injection Exploit. Since the compiler can now execute arbitrary code, someone passing around malicious source code could do anything to

Re: Compile time executable calling?

2013-07-13 Thread Paulo Pinto
Am 13.07.2013 01:43, schrieb H. S. Teoh: On Fri, Jul 12, 2013 at 03:35:30PM -0700, Walter Bright wrote: On 7/12/2013 3:12 PM, Timothee Cour wrote: I think the OP was refering to something different: ability to call an arbitrary executable / shell command during compile time of a D function,

Re: Compile time executable calling?

2013-07-13 Thread Tofu Ninja
On Saturday, 13 July 2013 at 07:13:37 UTC, Walter Bright wrote: On 7/12/2013 11:52 PM, BLM768 wrote: On Saturday, 13 July 2013 at 04:23:56 UTC, Walter Bright wrote: A big problem with it would be the equivalent of the SQL Injection Exploit. Since the compiler can now execute arbitrary code,

Re: Compile time executable calling?

2013-07-13 Thread Peter Alexander
On Friday, 12 July 2013 at 23:34:05 UTC, Timothee Cour wrote: regarding added complexity: the only thing this adds is 1 function (calling an executable, with option to redirect stdin/out/err). And yes, that could read mail as you joked if the user called such a program inside his D function,

Re: Compile time executable calling?

2013-07-13 Thread Daniel Kozak
On Friday, 12 July 2013 at 22:46:39 UTC, Justin Whear wrote: On Sat, 13 Jul 2013 00:36:21 +0200, Peter Alexander wrote: On Friday, 12 July 2013 at 20:42:50 UTC, Tofu Ninja wrote: So I had an idea recently, wouldn't it be cool to have the ability to call an executable at compile time and

Re: Compile time executable calling?

2013-07-13 Thread Peter Alexander
On Saturday, 13 July 2013 at 11:19:49 UTC, Daniel Kozak wrote: A few minutes ago, I have a same issue. I need add some enum values as a compile option. Now I have something like this: version (Parser) { enum Application = parser; } version (Report) { enum Application = report;

Re: Compile time executable calling?

2013-07-13 Thread Piotr Szturmaj
W dniu 13.07.2013 09:13, Walter Bright pisze: On 7/12/2013 11:52 PM, BLM768 wrote: On Saturday, 13 July 2013 at 04:23:56 UTC, Walter Bright wrote: A big problem with it would be the equivalent of the SQL Injection Exploit. Since the compiler can now execute arbitrary code, someone passing

Re: Compile time executable calling?

2013-07-13 Thread Ary Borenszweig
On 7/12/13 5:42 PM, Tofu Ninja wrote: So I had an idea recently, wouldn't it be cool to have the ability to call an executable at compile time and capture its output. Something like the string imports but instead of opening and reading a text file, it run an executable, waits for it to finish,

Re: Compile time executable calling?

2013-07-13 Thread Walter Bright
On 7/13/2013 1:34 AM, Tofu Ninja wrote: Any idea how difficult such a thing would be to implement? Any one willing to work on something like this? If something like this was made, would it be included? It would be easy to implement. I don't know if it should be included or not, though.

Re: Compile time executable calling?

2013-07-13 Thread Daniel Kozak
On Saturday, 13 July 2013 at 11:25:05 UTC, Peter Alexander wrote: On Saturday, 13 July 2013 at 11:19:49 UTC, Daniel Kozak wrote: A few minutes ago, I have a same issue. I need add some enum values as a compile option. Now I have something like this: version (Parser) { enum Application

Compile time executable calling?

2013-07-12 Thread Tofu Ninja
So I had an idea recently, wouldn't it be cool to have the ability to call an executable at compile time and capture its output. Something like the string imports but instead of opening and reading a text file, it run an executable, waits for it to finish, and grabs its output. It would get

Re: Compile time executable calling?

2013-07-12 Thread Timothee Cour
On Fri, Jul 12, 2013 at 1:42 PM, Tofu Ninja emmo...@purdue.edu wrote: So I had an idea recently, wouldn't it be cool to have the ability to call an executable at compile time and capture its output. Something like the string imports but instead of opening and reading a text file, it run an

Re: Compile time executable calling?

2013-07-12 Thread Walter Bright
On 7/12/2013 1:42 PM, Tofu Ninja wrote: So I had an idea recently, wouldn't it be cool to have the ability to call an executable at compile time and capture its output. Something like the string imports but instead of opening and reading a text file, it run an executable, waits for it to finish,

Re: Compile time executable calling?

2013-07-12 Thread Timothee Cour
On Fri, Jul 12, 2013 at 2:54 PM, Walter Bright newshou...@digitalmars.comwrote: On 7/12/2013 1:42 PM, Tofu Ninja wrote: So I had an idea recently, wouldn't it be cool to have the ability to call an executable at compile time and capture its output. Something like the string imports but

Re: Compile time executable calling?

2013-07-12 Thread Walter Bright
On 7/12/2013 3:12 PM, Timothee Cour wrote: I think the OP was refering to something different: ability to call an arbitrary executable / shell command during compile time of a D function, whereas optabgen is during compiling dmd itself: It's still the same idea - using external programs to

Re: Compile time executable calling?

2013-07-12 Thread Peter Alexander
On Friday, 12 July 2013 at 20:42:50 UTC, Tofu Ninja wrote: So I had an idea recently, wouldn't it be cool to have the ability to call an executable at compile time and capture its output. How long until D compilers are able to read mail? :-) There's many obvious applications of this proposed

Re: Compile time executable calling?

2013-07-12 Thread Justin Whear
On Sat, 13 Jul 2013 00:36:21 +0200, Peter Alexander wrote: On Friday, 12 July 2013 at 20:42:50 UTC, Tofu Ninja wrote: So I had an idea recently, wouldn't it be cool to have the ability to call an executable at compile time and capture its output. How long until D compilers are able to read

Re: Compile time executable calling?

2013-07-12 Thread Tofu Ninja
On Friday, 12 July 2013 at 22:36:22 UTC, Peter Alexander wrote: On Friday, 12 July 2013 at 20:42:50 UTC, Tofu Ninja wrote: So I had an idea recently, wouldn't it be cool to have the ability to call an executable at compile time and capture its output. How long until D compilers are able to

Re: Compile time executable calling?

2013-07-12 Thread Timothee Cour
On Fri, Jul 12, 2013 at 3:36 PM, Peter Alexander peter.alexander...@gmail.com wrote: On Friday, 12 July 2013 at 20:42:50 UTC, Tofu Ninja wrote: So I had an idea recently, wouldn't it be cool to have the ability to call an executable at compile time and capture its output. How long until D

Re: Compile time executable calling?

2013-07-12 Thread H. S. Teoh
On Fri, Jul 12, 2013 at 03:35:30PM -0700, Walter Bright wrote: On 7/12/2013 3:12 PM, Timothee Cour wrote: I think the OP was refering to something different: ability to call an arbitrary executable / shell command during compile time of a D function, whereas optabgen is during compiling dmd

Re: Compile time executable calling?

2013-07-12 Thread H. S. Teoh
On Sat, Jul 13, 2013 at 12:51:03AM +0200, Tofu Ninja wrote: On Friday, 12 July 2013 at 22:36:22 UTC, Peter Alexander wrote: On Friday, 12 July 2013 at 20:42:50 UTC, Tofu Ninja wrote: So I had an idea recently, wouldn't it be cool to have the ability to call an executable at compile time and

Re: Compile time executable calling?

2013-07-12 Thread Timothee Cour
On Fri, Jul 12, 2013 at 4:51 PM, H. S. Teoh hst...@quickfur.ath.cx wrote: On Sat, Jul 13, 2013 at 12:51:03AM +0200, Tofu Ninja wrote: On Friday, 12 July 2013 at 22:36:22 UTC, Peter Alexander wrote: On Friday, 12 July 2013 at 20:42:50 UTC, Tofu Ninja wrote: So I had an idea recently,

Re: Compile time executable calling?

2013-07-12 Thread H. S. Teoh
On Fri, Jul 12, 2013 at 05:00:29PM -0700, Timothee Cour wrote: On Fri, Jul 12, 2013 at 4:51 PM, H. S. Teoh hst...@quickfur.ath.cx wrote: On Sat, Jul 13, 2013 at 12:51:03AM +0200, Tofu Ninja wrote: On Friday, 12 July 2013 at 22:36:22 UTC, Peter Alexander wrote: On Friday, 12 July 2013 at

Re: Compile time executable calling?

2013-07-12 Thread Timothee Cour
On Fri, Jul 12, 2013 at 5:10 PM, H. S. Teoh hst...@quickfur.ath.cx wrote: On Fri, Jul 12, 2013 at 05:00:29PM -0700, Timothee Cour wrote: On Fri, Jul 12, 2013 at 4:51 PM, H. S. Teoh hst...@quickfur.ath.cx wrote: On Sat, Jul 13, 2013 at 12:51:03AM +0200, Tofu Ninja wrote: On Friday, 12

Re: Compile time executable calling?

2013-07-12 Thread H. S. Teoh
On Fri, Jul 12, 2013 at 05:39:45PM -0700, Timothee Cour wrote: On Fri, Jul 12, 2013 at 5:10 PM, H. S. Teoh hst...@quickfur.ath.cx wrote: On Fri, Jul 12, 2013 at 05:00:29PM -0700, Timothee Cour wrote: On Fri, Jul 12, 2013 at 4:51 PM, H. S. Teoh hst...@quickfur.ath.cx wrote: On Sat,

Re: Compile time executable calling?

2013-07-12 Thread Timothee Cour
On Fri, Jul 12, 2013 at 6:14 PM, H. S. Teoh hst...@quickfur.ath.cx wrote: On Fri, Jul 12, 2013 at 05:39:45PM -0700, Timothee Cour wrote: On Fri, Jul 12, 2013 at 5:10 PM, H. S. Teoh hst...@quickfur.ath.cx wrote: On Fri, Jul 12, 2013 at 05:00:29PM -0700, Timothee Cour wrote: On Fri,

Re: Compile time executable calling?

2013-07-12 Thread Walter Bright
On 7/12/2013 5:00 PM, Timothee Cour wrote: Let's put it another way: if I or someone else made a pull request for CTFE exec, would it have a chance of being accepted? A big problem with it would be the equivalent of the SQL Injection Exploit. Since the compiler can now execute arbitrary code,