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
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 simple,
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 :)
On 31.01.15 15:45, RuZzz wrote:
Maybe I need good examples on C++, for this class, because a lot of
examples on C++.
Maybe this can help you:
https://github.com/andersonpd/decimal
On 31.01.15 15:56, zeljkog wrote:
On 31.01.15 15:45, RuZzz wrote:
Maybe I need good examples on C++, for this class, because a lot of
examples on C++.
Maybe this can help you:
https://github.com/andersonpd/decimal
Also
http://code.dlang.org/packages/eris
On 31.01.15 17:04, tcak wrote:
I do not have a big example in the end to show, but is there any way to
put labels into struct definitions?
struct CommunicationMessage{
char[2] signature;
mainData:
int info1;
int info2;
extraData:
ushort checksum;
content:
}
Members of
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:
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
On 26.01.15 14:37, Nick Treleaven wrote:
On 26/01/2015 05:15, Adam D. Ruppe wrote:
Also available via RSS: http://arsdnet.net/this-week-in-d/twid.rss
Much appreciated - now works with my Thunderbird, thanks :)
Double :)
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:
Russel Winder:
but
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
easier
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]
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 state
On 24.01.15 18:26, zeljkog wrote:
Until now I concluded:
1. Resulting range must be output range. Right?
Should be input range.
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 = predicate;
...
The problem is here - the creation of
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
But
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
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))
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 seen code like this before, and it looks like the
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,
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've never
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 handle
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
I tried:
--
import std.stdio, std.algorithm;
auto unique(){
bool[int] c;
return (int a){
if (a in c)
return false;
else{
c[a] = true;
return true;
}
};
}
void main()
{
[1, 5, 5, 2, 1, 5, 6,
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 than the
On 22.01.15 20:05, Meta wrote:
On Thursday, 22 January 2015 at 19:00:47 UTC, zeljkog wrote:
On 22.01.15 19:26, Meta wrote:
On Thursday, 22 January 2015 at 18:23:00 UTC, Meta wrote:
Whoops, I forgot to make it a template to force CTFE.
You can force CTFE assigning to manifest constant.
enum
On 22.01.15 19:26, Meta wrote:
On Thursday, 22 January 2015 at 18:23:00 UTC, Meta wrote:
Whoops, I forgot to make it a template to force CTFE.
You can force CTFE assigning to manifest constant.
enum t = charRange!...
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.
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!();
}
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
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.
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?
This compiles:
import std.container;
class Node
{
DList!Node children;
}
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
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
On 19.12.14 16:25, Steven Schveighoffer wrote:
This is surprising to me. I would expect especially ints to be faster.
In reality, there is no difference between arr ~= args and arr.length +=
args.length, and then copying, it's just how you do the copying. Perhaps
it's the call to memcpy in the
On 19.12.14 23:56, Ali Çehreli wrote:
Can we see the test code please.
Ali
import std.stdio, std.datetime, std.random;
int N = 10_000;
int len = 1000;
int k = 4;
struct S{
int n1, n2;
//~ this(this){
//~ writeln(this(this));
//~ }
}
ref T[] append(T, Args...)(ref T[]
If you wish run this just add:
struct S{
int n1, n2, n3, n4, n5 ...;
}
On 18.12.14 14:50, Steven Schveighoffer wrote:
I wonder how your code compares to this:
void append(T)(ref T[] arr, T[] args...)
{
arr ~= args;
}
This is ~20% slower for ints, but it difference increases for bigger structs.
On 15.12.14 01:00, Nordlöw wrote:
Isn't this algorithm already encoded somewhere in Phobos?
void append(T, Args...)(ref T[] arr, auto ref Args args){
{
static if (args.length == 1)
arr ~= args[0]; // inlined
else{
arr.length += args.length;
foreach(i, e; args)
On 17.12.14 13:30, Tobias Pankrath wrote:
void append(T, Args...)(ref T[] data, Args args)
{
static size_t estimateLength(Args args)
{
size_t result;
foreach(e; args)
static if(hasLength!(typeof(e)))
result += e.length;
else
On 15.12.14 00:16, Nordlöw wrote:
or some other trick?
void append(T, Args...)(ref T[] arr, Args args){
arr.length += args.length;
foreach(i, e; args)
arr[$ - args.length + i] = args[i];
}
void main()
{
int[] arr = [1, 2, 3, 4, 5];
arr.append(3, 10, 14);
writeln(arr);
}
output:
On 15.12.14 01:00, Nordlöw wrote:
Isn't this algorithm already encoded somewhere in Phobos?
I don't know.
import std.stdio, core.thread;
struct Tree{
int val;
Tree[] tree;
}
struct TreeRange{
Tree curtree;
bool empty;
Fiber worker;
this(Tree t){
worker = new Fiber(fiberFunc);
curtree = t;
popFront();
}
void fiberFunc(){
Tree t = curtree;
Fiber.yield();
On 13.12.14 13:01, zeljkog wrote:
void main() {
auto tt = Tree(5, [Tree(7,[Tree(11), Tree(4)]), Tree(10)]);
auto tr1 = TreeRange(tt);
foreach(v; tr1){
writef(%2d, , v);
}
writeln();
for(auto r = TreeRange(tt); !r.empty; r.popFront())
writef(%2d, , r.front);
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).
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 transition
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);
void
48 matches
Mail list logo