Re: Scriptlike v0.9.4 - Perl-like interpolated strings, full examples and more.

2015-09-26 Thread Jacob Carlborg via Digitalmars-d-announce
On 2015-09-25 23:28, H. S. Teoh via Digitalmars-d-announce wrote: It's to work around a dmd bug that doesn't allow overloads between templates and non-templates. But I just checked, looks like that bug may have been fixed since, so now the following overloads would work: void writefln(

Re: Scriptlike v0.9.4 - Perl-like interpolated strings, full examples and more.

2015-09-25 Thread H. S. Teoh via Digitalmars-d-announce
On Fri, Sep 25, 2015 at 02:14:30PM +0200, Jacob Carlborg via Digitalmars-d-announce wrote: > On 2015-09-25 02:15, H. S. Teoh via Digitalmars-d-announce wrote: > > >I wanted to work on it, but haven't actually gotten to it yet. > >Basically, the idea is relatively simple: > > > > // compile-ti

Re: Scriptlike v0.9.4 - Perl-like interpolated strings, full examples and more.

2015-09-25 Thread Meta via Digitalmars-d-announce
On Friday, 25 September 2015 at 14:38:33 UTC, Nick Sabalausky wrote: I like that idea. It it feasible? I'd always assumed the syntaxes were different because they needed to be for some sort of technical reason. But now that I look at it...maybe that could work after all? At first glance I can

Re: Scriptlike v0.9.4 - Perl-like interpolated strings, full examples and more.

2015-09-25 Thread Nick Sabalausky via Digitalmars-d-announce
On 09/23/2015 08:42 PM, Meta wrote: What about even just removing the syntax distinction between string mixins and template mixins? mixin "int i = 0"; mixin declareI!(); I like that idea. It it feasible? I'd always assumed the syntaxes were different because they needed to be for some sort

Re: Scriptlike v0.9.4 - Perl-like interpolated strings, full examples and more.

2015-09-25 Thread Jacob Carlborg via Digitalmars-d-announce
On 2015-09-25 02:15, H. S. Teoh via Digitalmars-d-announce wrote: I wanted to work on it, but haven't actually gotten to it yet. Basically, the idea is relatively simple: // compile-time variant void writefln(string format="", A...)(A args) if (format.length > 0)

Re: Scriptlike v0.9.4 - Perl-like interpolated strings, full examples and more.

2015-09-25 Thread Sönke Ludwig via Digitalmars-d-announce
Am 23.09.2015 um 16:33 schrieb Nick Sabalausky: (...) void main() { int somevar = 42; mixin interp; iwriteln!("This is ${somevar}."); int another = 17; iwriteln!("This won't work, using ${another}."); } Seems like it would be too awkward and confusing to be worthwhile.

Re: Scriptlike v0.9.4 - Perl-like interpolated strings, full examples and more.

2015-09-24 Thread H. S. Teoh via Digitalmars-d-announce
On Thu, Sep 24, 2015 at 08:00:53PM -0400, Andrei Alexandrescu via Digitalmars-d-announce wrote: [...] > Yah, I think we need something like that in the stdlib. Also, we need > writefln with compile-time format string (someone was working on it > but I haven't heard about it in a while). -- Andrei

Re: Scriptlike v0.9.4 - Perl-like interpolated strings, full examples and more.

2015-09-24 Thread Andrei Alexandrescu via Digitalmars-d-announce
On 09/23/2015 01:44 AM, Sönke Ludwig wrote: Am 22.09.2015 um 22:18 schrieb Nick Sabalausky: = String Interpolation: = https://github.com/Abscissa/scriptlike#string-interpolation AFAICT, a string mixin is necessary to accomplish this in D, but otherwise it

Re: Scriptlike v0.9.4 - Perl-like interpolated strings, full examples and more.

2015-09-23 Thread Jacob Carlborg via Digitalmars-d-announce
On 2015-09-23 15:59, Ben Boeckel via Digitalmars-d-announce wrote: Be aware that you will have to pay an extra lstat call for such a function so that *it* can call the right function. It certainly shouldn't replace the existing functions. Perhaps not in Phobos, but I don't see why someone usin

Re: Scriptlike v0.9.4 - Perl-like interpolated strings, full examples and more.

2015-09-23 Thread Meta via Digitalmars-d-announce
On Wednesday, 23 September 2015 at 19:28:03 UTC, Nick Sabalausky wrote: On 09/23/2015 03:18 PM, Chad Joan wrote: This is why I argued for alternative mixin syntax in D some ... years? ... ago. It'd be really cool to have a writefln overload that did this: int somevar = 42; writefln#("This i

Re: Scriptlike v0.9.4 - Perl-like interpolated strings, full examples and more.

2015-09-23 Thread Chad Joan via Digitalmars-d-announce
On Wednesday, 23 September 2015 at 19:28:03 UTC, Nick Sabalausky wrote: On 09/23/2015 03:18 PM, Chad Joan wrote: This is why I argued for alternative mixin syntax in D some ... years? ... ago. It'd be really cool to have a writefln overload that did this: int somevar = 42; writefln#("This i

Re: Scriptlike v0.9.4 - Perl-like interpolated strings, full examples and more.

2015-09-23 Thread Nick Sabalausky via Digitalmars-d-announce
On 09/23/2015 03:18 PM, Chad Joan wrote: This is why I argued for alternative mixin syntax in D some ... years? ... ago. It'd be really cool to have a writefln overload that did this: int somevar = 42; writefln#("This is ${somevar}"); writefln#("Plus two and you get ${somevar+1}"); Which wou

Re: Scriptlike v0.9.4 - Perl-like interpolated strings, full examples and more.

2015-09-23 Thread Chad Joan via Digitalmars-d-announce
On Wednesday, 23 September 2015 at 14:33:23 UTC, Nick Sabalausky wrote: On 09/23/2015 01:44 AM, Sönke Ludwig wrote: An alternative idea would be to mix in a local "writeln" function, which can then be used multiple times without syntax overhead: mixin template interp() { void iwriteln(s

Re: Scriptlike v0.9.4 - Perl-like interpolated strings, full examples and more.

2015-09-23 Thread Nick Sabalausky via Digitalmars-d-announce
On 09/23/2015 02:30 AM, Jacob Carlborg wrote: On 2015-09-22 22:18, Nick Sabalausky wrote: Big update to Scriptlike, v0.9.4: https://github.com/Abscissa/scriptlike Scriptlike is a library to help you write script-like programs in D. One thing that really bugs me in Phobos, Scriptlike seems to

Re: Scriptlike v0.9.4 - Perl-like interpolated strings, full examples and more.

2015-09-23 Thread Nick Sabalausky via Digitalmars-d-announce
On 09/23/2015 02:21 AM, Jacob Carlborg wrote: Different bikeshedding: I would prefer to make the curly braces optional if it only contains a symbol. I agree. I've left that as a future enhancement for the right now. Although it shouldn't be too difficult a change. Filing it here: https://g

Re: Scriptlike v0.9.4 - Perl-like interpolated strings, full examples and more.

2015-09-23 Thread Nick Sabalausky via Digitalmars-d-announce
On 09/23/2015 01:44 AM, Sönke Ludwig wrote: An alternative idea would be to mix in a local "writeln" function, which can then be used multiple times without syntax overhead: mixin template interp() { void iwriteln(string str)() { // pretend that we actually parse the string ;

Re: Scriptlike v0.9.4 - Perl-like interpolated strings, full examples and more.

2015-09-23 Thread Ben Boeckel via Digitalmars-d-announce
On Wed, Sep 23, 2015 at 08:30:18 +0200, Jacob Carlborg via Digitalmars-d-announce wrote: > One thing that really bugs me in Phobos, Scriptlike seems to have the > same problem, is that there are three (!!!) different functions to > remove something from the file system. Give me just one function

Re: Scriptlike v0.9.4 - Perl-like interpolated strings, full examples and more.

2015-09-23 Thread Jacob Carlborg via Digitalmars-d-announce
On 2015-09-23 08:32, Dmitry Olshansky wrote: Bugzilla issue with this enhancement would help a lot with this ;) And a PR would make it happen... https://issues.dlang.org/show_bug.cgi?id=15102 I'm too lazy for a PR. -- /Jacob Carlborg

Re: Scriptlike v0.9.4 - Perl-like interpolated strings, full examples and more.

2015-09-22 Thread Dmitry Olshansky via Digitalmars-d-announce
On 23-Sep-2015 09:30, Jacob Carlborg wrote: On 2015-09-22 22:18, Nick Sabalausky wrote: Big update to Scriptlike, v0.9.4: https://github.com/Abscissa/scriptlike Scriptlike is a library to help you write script-like programs in D. One thing that really bugs me in Phobos, Scriptlike seems to ha

Re: Scriptlike v0.9.4 - Perl-like interpolated strings, full examples and more.

2015-09-22 Thread Jacob Carlborg via Digitalmars-d-announce
On 2015-09-22 22:18, Nick Sabalausky wrote: Big update to Scriptlike, v0.9.4: https://github.com/Abscissa/scriptlike Scriptlike is a library to help you write script-like programs in D. One thing that really bugs me in Phobos, Scriptlike seems to have the same problem, is that there are three

Re: Scriptlike v0.9.4 - Perl-like interpolated strings, full examples and more.

2015-09-22 Thread Jacob Carlborg via Digitalmars-d-announce
On 2015-09-22 22:18, Nick Sabalausky wrote: = String Interpolation: = https://github.com/Abscissa/scriptlike#string-interpolation AFAICT, a string mixin is necessary to accomplish this in D, but otherwise it works much like other languages: -

Re: Scriptlike v0.9.4 - Perl-like interpolated strings, full examples and more.

2015-09-22 Thread Sönke Ludwig via Digitalmars-d-announce
Am 22.09.2015 um 22:18 schrieb Nick Sabalausky: = String Interpolation: = https://github.com/Abscissa/scriptlike#string-interpolation AFAICT, a string mixin is necessary to accomplish this in D, but otherwise it works much like other languages: --

Re: Scriptlike v0.9.4 - Perl-like interpolated strings, full examples and more.

2015-09-22 Thread Sebastiaan Koppe via Digitalmars-d-announce
On Wednesday, 23 September 2015 at 01:45:03 UTC, Adam D. Ruppe wrote: On Wednesday, 23 September 2015 at 01:24:54 UTC, Sebastiaan Koppe wrote: What about: void echo(T)() { writeln(mixin(interp!T)); Won't work because it won't be able to see the local variables you want to interpolate. fa

Re: Scriptlike v0.9.4 - Perl-like interpolated strings, full examples and more.

2015-09-22 Thread Adam D. Ruppe via Digitalmars-d-announce
On Wednesday, 23 September 2015 at 01:24:54 UTC, Sebastiaan Koppe wrote: What about: void echo(T)() { writeln(mixin(interp!T)); Won't work because it won't be able to see the local variables you want to interpolate.

Re: Scriptlike v0.9.4 - Perl-like interpolated strings, full examples and more.

2015-09-22 Thread Sebastiaan Koppe via Digitalmars-d-announce
On Tuesday, 22 September 2015 at 20:18:48 UTC, Nick Sabalausky wrote: // Output: The number 21 doubled is 42! int num = 21; writeln( mixin(interp!"The number ${num} doubled is ${num * 2}!") ); What abo

Scriptlike v0.9.4 - Perl-like interpolated strings, full examples and more.

2015-09-22 Thread Nick Sabalausky via Digitalmars-d-announce
Big update to Scriptlike, v0.9.4: https://github.com/Abscissa/scriptlike Scriptlike is a library to help you write script-like programs in D. The two highlights in this release are string interpolation and a full set of examples in the documentation. Also of note are the new functions removePa