Re: DIP56 - inlining

2015-02-04 Thread zeljkog via Digitalmars-d
On 04.02.15 07:46, Zach the Mystic wrote: It's a bikeshed argument, but why not: pragma(inline, always); // warn if unable to inline pragma(inline, never); pragma(inline);// revert to default behavior ...? I know `true` and `false` are keywords, but why confuse people? What is a "tru

Re: H1 2015 Priorities and Bare-Metal Programming

2015-02-03 Thread zeljkog via Digitalmars-d
On 03.02.15 10:35, Walter Bright wrote: > On 2/3/2015 1:11 AM, Mike wrote: >> Another way of putting it: Does pragma(inline, true) simply allow the >> user to >> compiler parts of their source file with -inline? > > Yes. > Eh, yes :) I see now, errors/warnings are invasive compared to this si

Re: H1 2015 Priorities and Bare-Metal Programming

2015-02-02 Thread zeljkog via Digitalmars-d
On 03.02.15 00:29, Walter Bright wrote: Now, when it can't inline, do you expect the compiler to produce an error message? Or warning? Microcontroller programmers like to look at produced code, no need to force them :)

Re: Time for 2.067

2015-01-31 Thread zeljkog via Digitalmars-d
On 30.01.15 23:24, AndyC wrote: > On Friday, 30 January 2015 at 22:06:34 UTC, Walter Bright wrote: >> Time to button this up and release it. Remaining regressions: >> >> https://issues.dlang.org/buglist.cgi?bug_severity=regression&bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED&list_id=19229

Re: accept @pure @nothrow @return attributes

2015-01-28 Thread zeljkog via Digitalmars-d
On 28.01.15 14:14, bearophile wrote: Dicebot: Yes, but it didn't also fix anything, only introduced more ways to do the same thing - without any plans for some consistent model. One of the rules of the Python Zen: There should be one-- and preferably only one --obvious way to do it. Yes b

Re: accept @pure @nothrow @return attributes

2015-01-26 Thread zeljkog via Digitalmars-d
On 26.01.15 23:08, Walter Bright wrote: > > I strongly dislike context sensitive tokens, whether or not they are > done by the lexer or the parser or the semantic analysis. > > It's like using a nail for a cotter pin. I remember the first time I read about D was something like "make language e

Re: [WORK] groupBy is in! Next: aggregate

2015-01-26 Thread zeljkog via Digitalmars-d
On 26.01.15 19:05, Andrei Alexandrescu wrote: > On 1/26/15 9:50 AM, Ary Borenszweig wrote: >> On 1/26/15 2:34 PM, Andrei Alexandrescu wrote: >>> On 1/26/15 8:11 AM, H. S. Teoh via Digitalmars-d wrote: On Mon, Jan 26, 2015 at 11:26:04AM +, bearophile via Digitalmars-d wrote: > Russ

Re: std.experimental.logger formal review round 3

2015-01-25 Thread zeljkog via Digitalmars-d
On 25.01.15 15:06, Robert burner Schadek wrote: > On Sunday, 25 January 2015 at 09:43:36 UTC, Jacob Carlborg wrote: >> >> Is the generated documentation for package module available somewhere? >> This [1] is empty. >> >> [1] >> http://burner.github.io/phobos/phobos-prerelease/std_experimental_log

Re: sortUniq

2015-01-24 Thread zeljkog via Digitalmars-d
On 24.01.15 19:47, Andrei Alexandrescu wrote: >> >> But here there is potential problem with shared state after save? > > It's not a problem - save saves the state of the iteration, not the data > being iterated. -- Andrei > If you pass stateful object with opCall or closure it becomes part of

Re: sortUniq

2015-01-24 Thread zeljkog via Digitalmars-d
On 24.01.15 19:35, Andrei Alexandrescu wrote: On 1/24/15 9:34 AM, zeljkog wrote: On 24.01.15 18:26, zeljkog wrote: Until now I concluded: 1. Resulting range must be output range. Right? Should be input range. For filter it's a forward range if input is forward or better. -- Andrei

Re: sortUniq

2015-01-24 Thread zeljkog via Digitalmars-d
On 24.01.15 18:26, zeljkog wrote: Until now I concluded: 1. Resulting range must be output range. Right? Should be input range.

Re: sortUniq

2015-01-24 Thread zeljkog via Digitalmars-d
On 24.01.15 18:02, Andrei Alexandrescu wrote: > On 1/24/15 7:17 AM, zeljkog wrote: >> >> private struct FilterResult(alias predicate, Range) >> { >> static if (is(predicate == struct)) >> predicate pred; >> else >> alias pred

Re: sortUniq

2015-01-24 Thread zeljkog via Digitalmars-d
On 24.01.15 16:17, zeljkog wrote: > template filter(alias predicate) if (is(typeof(unaryFun!predicate))) Should be: template filter(alias predicate) if (is(typeof(unaryFun!predicate)) || is(predicate == struct))

Re: sortUniq

2015-01-24 Thread zeljkog via Digitalmars-d
On 24.01.15 15:53, Andrei Alexandrescu wrote: On 1/24/15 4:13 AM, zeljkog wrote: On 24.01.15 12:50, Peter Alexander wrote: auto f = unique(); [1, 5, 5, 2, 1, 5, 6, 6].filter!(f).writeln; // [1, 5, 2, 6] Filter needs an alias, and you cannot alias an R-value (it has no symbol). Yes, I see

Re: sortUniq

2015-01-24 Thread zeljkog via Digitalmars-d
On 24.01.15 12:50, Peter Alexander wrote: > auto f = unique(); > [1, 5, 5, 2, 1, 5, 6, 6].filter!(f).writeln; // [1, 5, 2, 6] > > Filter needs an alias, and you cannot alias an R-value (it has no symbol). Yes, I see :) But I think this should be supported by std.algorithm: import std.stdio, st

Re: sortUniq

2015-01-24 Thread zeljkog via Digitalmars-d
On 23.01.15 19:05, zeljkog wrote: > On 23.01.15 18:48, H. S. Teoh via Digitalmars-d wrote: >> >> I think what he's trying to do is to call a function that returns a >> delegate, and use that delegate to instantiate the filter template. >> AFAIK I've never see

Re: sortUniq

2015-01-23 Thread zeljkog via Digitalmars-d
On 23.01.15 19:13, Andrei Alexandrescu wrote: On 1/23/15 10:05 AM, zeljkog wrote: On 23.01.15 18:48, H. S. Teoh via Digitalmars-d wrote: I think what he's trying to do is to call a function that returns a delegate, and use that delegate to instantiate the filter template. AFAIK I

Re: sortUniq

2015-01-23 Thread zeljkog via Digitalmars-d
On 23.01.15 18:48, H. S. Teoh via Digitalmars-d wrote: > > I think what he's trying to do is to call a function that returns a > delegate, and use that delegate to instantiate the filter template. > AFAIK I've never seen code like this before, and it looks like the > compiler isn't prepared to han

Re: sortUniq

2015-01-23 Thread zeljkog via Digitalmars-d
On 22.01.15 22:40, Andrei Alexandrescu wrote: There's this classic patter on Unix: |sort|uniq, i.e. sort some data and only display the unique elements. Loosely-related, compiling ... auto ret = arr.filter!(myFilter()); ... I got: Error: closures are not yet supported in CTFE Using struct

Re: D on Slashdot

2015-01-22 Thread zeljkog via Digitalmars-d
On 22.01.15 17:27, Adam D. Ruppe wrote: Of course, eventually I'll write my own shell with my own completion function! terminal.d is slowly getting there. I'm used to editor. Execute current line - skip comment tags (keyboard shortcut) is all I need.

Re: Compile time iota

2015-01-22 Thread zeljkog via Digitalmars-d
On 22.01.15 14:06, Nick Treleaven wrote: On 21/01/2015 19:15, zeljkog wrote: And good name staticIota, unlike TypeTuple. I always wonder what is raw tuple, TypeTuple or Tuple :) Yes, there's a DIP to rename std.typetuple to std.meta.list. I made a pull to do that (which goes further tha

Re: Compile time iota

2015-01-21 Thread zeljkog via Digitalmars-d
On 21.01.15 19:23, H. S. Teoh via Digitalmars-d wrote: This is actually already implemented as std.typecons.staticIota, but it's currently undocumented and restricted to only Phobos code. I'm not sure why it was decided not to make it public, but if you file an enhancement request, the devs can

Compile time iota

2015-01-21 Thread zeljkog via Digitalmars-d
Maybe something like this can be added to Fobos: template Iota(int start, int stop, int step = 1){ template tuple(T...){ alias tuple = T; } static if(start < stop) alias Iota = tuple!(start, Iota!(start + step, stop, step)); else alias Iota = tuple!(); }

Re: post qualifier and template constraint limitation, is there a reason ?

2015-01-17 Thread zeljkog via Digitalmars-d
On 17.01.15 09:33, deadalnix wrote: This is accepted : auto fun(T)(T T) inout if(...) { ... } This is not : auto fun(T)(T T) if(...) inout { ... } Is there a reason ? I think it improves readability. A little :) Often user don't care to read if-part.

Re: http://wiki.dlang.org/DIP25 has been preliminarily approved for 2.067

2015-01-16 Thread zeljkog via Digitalmars-d
On 16.01.15 22:41, Andrei Alexandrescu wrote: Please help us work the kinks out! Walter will be proceeding with the opt-in implementation for quicker pipelining. http://wiki.dlang.org/DIP25 Andrei Why is it restricted to @safe?

Re: no size yet for forward reference for nested structures

2015-01-15 Thread zeljkog via Digitalmars-d
On 16.01.15 08:04, zeljkog wrote: On 15.01.15 23:30, Steven Schveighoffer wrote: On 1/15/15 9:56 AM, zeljkog wrote: This compiles: import std.container; class Node { DList!Node children; } Then use DList? DList is not SList, they were written by different people. -Steve

Re: no size yet for forward reference for nested structures

2015-01-15 Thread zeljkog via Digitalmars-d
On 15.01.15 23:30, Steven Schveighoffer wrote: On 1/15/15 9:56 AM, zeljkog wrote: This compiles: import std.container; class Node { DList!Node children; } Then use DList? DList is not SList, they were written by different people. -Steve SList.Range has moveFront, DList.Range does

Re: no size yet for forward reference for nested structures

2015-01-15 Thread zeljkog via Digitalmars-d
This compiles: import std.container; class Node { DList!Node children; }

Re: DIP69 - Implement scope for escape proof references

2014-12-11 Thread zeljkog via Digitalmars-d
On Thursday, 4 December 2014 at 10:00:37 UTC, Walter Bright wrote: On 12/4/2014 1:51 AM, eles wrote: Making it implicit and requiring an explicit "escape" for un-scoped variables? Was afraid that would break too much code. Compiler switch: escape=I(gnore)|W(arning)|E(rror). For transitio

Re: DIP69 - Implement scope for escape proof references

2014-12-11 Thread zeljkog via Digitalmars-d
On 11.12.14 08:25, Shammah Chancellor wrote: This is exactly why this feature should be default behavior with compiler warnings generated when things escape scope. It can be compiler switch escape=I(gnore)|W(arning)|E(rror).

Re: DIP69 - Implement scope for escape proof references

2014-12-08 Thread zeljkog via Digitalmars-d
On 05.12.14 21:55, Walter Bright wrote: > > It means that this code will be safe: > > void foo(scope int* p); > > p = malloc(n); > foo(p); > free(p); > > The rest is all the nuts and bolts of making that work. > If it is main goal, opposite looks more natural. void foo(int* p

rdmd

2012-03-30 Thread zeljkog
I suggest to add following line on top of rdmd main(): compiler = std.path.buildPath(std.path.dirName(args[0]), "dmd");

Random access range

2012-03-08 Thread zeljkog
import std.stdio; struct Rar{ int[] data = [1,3,5]; int length = 3; ref int opIndex(int i){ return data[i];} } void main() { Rar x; foreach (e; x) writeln(e); } Error: invalid foreach aggregate x Is'nt Rar valid random access range?

Re: Anonymous function syntax

2011-09-23 Thread zeljkog
While we are about rewrites, it would be nice one: symbol := expression; -> auto symbol = expression; 1. shorter 2. conspicuous, more readable. 3. highlights distinction between assignment and initialization. 4. will not break any existing code.

Re: Issue 4705

2011-09-16 Thread zeljkog
On 16.09.2011 23:58, zeljkog wrote: On 16.09.2011 23:38, Andrei Alexandrescu wrote: xyz!"ab"([1,2,3,1,2,3]) is 3 Question is what's a good name for xyz. Reduce, accumulate, fold... I mean reduce!"a

Re: Issue 4705

2011-09-16 Thread zeljkog
On 16.09.2011 23:38, Andrei Alexandrescu wrote: xyz!"ab"([1,2,3,1,2,3]) is 3 Question is what's a good name for xyz. Reduce, accumulate, fold...

Re: Issue 4705

2011-09-16 Thread zeljkog
On 16.09.2011 22:35, Simen Kjaeraas wrote: extremumCount!"ab"([1,2,3,1,2,3]) == [3,1,2,3]. and extremumEls!"a>b"([1,2,3,1,2,3]) == [3,3]

Re: Pull 375 and related enhancements

2011-09-11 Thread zeljkog
On 10.09.2011 11:30, bearophile wrote: Note: for me this syntax with $ is more commonly useful compared to the "..." syntax. I think that the proposed use of the operator $ a consistent and intuitive in the context. In this case ellipsis is unnecessary, "int [N] = [1];" automatically gets a

Re: RFC: StaticFilter, PApply, Compose, template predicates

2011-09-05 Thread zeljkog
On 05.09.2011 23:06, Timon Gehr wrote: The aggregate to loop over is evaluated at compile time: int[] getAggregate(){return [1,2,3,];} static foreach(x;getAggregate()) { pragma(msg,x); } Eh :) For me the only compile time agregate is tuple. We should talk about basic looping construct for c

Re: RFC: StaticFilter, PApply, Compose, template predicates

2011-09-05 Thread zeljkog
On 05.09.2011 21:55, Timon Gehr wrote: static foreach is part of the design. The only reason it is not in the compiler (and we have the kludgy foreach that works on tuples) is because Walter experienced implementation difficulties. Before implementation somebody must precisely define static

Re: Fast file copy (threaded or not?)

2011-09-02 Thread zeljkog
Marco Leise Wrote: > > void main(string[] args) > { > if (!enforce(args.length == 3, { > stderr.writefln("%s SOURCE DEST", args[0]); > })) return; > > auto sw = StopWatch(); > sw.start(); > > auto src = new MmFile(args[1], MmFile.Mode.Read, 0, null, 0); > a