Re: range.save

2015-11-24 Thread Freddy via Digitalmars-d
On Tuesday, 24 November 2015 at 01:53:39 UTC, Steven Schveighoffer wrote: ... I can't quite think of an example right now but there was a thread about this a few years ago. http://forum.dlang.org/thread/twnymbxfdmqupsfjf...@forum.dlang.org

Re: range.save

2015-11-23 Thread Freddy via Digitalmars-d
On Tuesday, 24 November 2015 at 01:03:36 UTC, Steven Schveighoffer wrote: surely you mean opIndex? Note that ranges are required to implement front, popFront, and empty. That's it, then it is a range. Even save isn't required unless you want it to be a forward range. I meant .indexableRange,

Re: range.save

2015-11-23 Thread Freddy via Digitalmars-d
On Thursday, 19 November 2015 at 21:30:23 UTC, Freddy wrote: ... Another problem I noticed with ranges is that all functionality is unionized. Ranges are expected to be able to popFront,Index,popBack, randomly possibly forcing ranges to carry unneeded buffers if indexing or popBack in never us

range.save

2015-11-19 Thread Freddy via Digitalmars-d
Does anyone else think range.save is a hack? I often find myself forgetting to call range.save in my generic code with my unittests working fine. Also, working with a range of ranges may forget to call range.save.(Ex: [1,2,4].repeat)

Re: DIP74 - where is at?

2015-10-11 Thread Freddy via Digitalmars-d
On Sunday, 11 October 2015 at 06:10:32 UTC, Jonathan M Davis wrote: alias is problematic, because it allows the class reference to escape. opDispatch doesn't have that problem, though there may be other complications that it introduces (I don't know). It does get kind of complicated though when

Re: DIP74 - where is at?

2015-10-10 Thread Freddy via Digitalmars-d
On Sunday, 11 October 2015 at 05:52:45 UTC, Freddy wrote: Speaking of DIP74 can't we just wrap a class in a struct with use reference counting with and use alias this? Also how will DIP74 work with incremental compilation? --- extern (D) class RcClass; void func(RcClass a) { //opps aut

Re: DIP74 - where is at?

2015-10-10 Thread Freddy via Digitalmars-d
On Saturday, 10 October 2015 at 23:25:49 UTC, Manu wrote: [...] Speaking of DIP74 can't we just wrap a class in a struct with use reference counting with and use alias this?

Re: DIP74 - where is at?

2015-10-10 Thread Freddy via Digitalmars-d
On Sunday, 11 October 2015 at 04:16:11 UTC, deadalnix wrote: The problem at hand is fairly well know at this stage: it is ownership. Everything else can be done as library. This.

Re: -> and :: operators

2015-10-09 Thread Freddy via Digitalmars-d
On Friday, 9 October 2015 at 04:15:42 UTC, Ali Çehreli wrote: Semi-relatedly, a colleague who has heard many D sales pitches from me over the years is recently "looking at Go" and liking it very much. He came to me today telling me about this awesome Go feature where you just type a dot after a

Re: Moving back to .NET

2015-10-08 Thread Freddy via Digitalmars-d
On Thursday, 8 October 2015 at 10:31:57 UTC, Chris wrote: 2. Solid non-gc memory management and ownership. Any specific implementation in mind? Well the first step to that should be implement a way to make sure pointers don't escape their scope.

Re: Moving back to .NET

2015-10-08 Thread Freddy via Digitalmars-d
On Thursday, 8 October 2015 at 14:02:58 UTC, Chris wrote: It'd be nice to have asm.js or even JS. The major ploblem I see right now with targeting asm.js is garbage collection. This can be worked around (I think) by having all pointers be fat pointers (size_t* stack_ref_count,T* data) and by

Fibers and Ranges

2015-10-04 Thread Freddy via Digitalmars-d
--- import core.thread; import std.conv; import std.stdio; void formatStuff(P)(P put, int stuff) { put("a"); put("b"); put("c"); put(stuff); foreach (i; 0 .. 10) { put(i ^^ stuff); } } auto formatRange(alias sub, T...)(T args) { class FormatFiber : Fiber

Re: Shout out to D at cppcon, when talkign about ranges.

2015-09-29 Thread Freddy via Digitalmars-d
On Wednesday, 30 September 2015 at 01:45:49 UTC, deadalnix wrote: https://www.youtube.com/watch?v=mFUXNMfaciE From http://wiki.dlang.org/Component_programming_with_ranges Congrat H. S. Teoh So this is what APL feels like. /s

Idioms you use

2015-09-28 Thread Freddy via Digitalmars-d
Are any D idioms you use that you like to share? Heres one of mine --- enum ctfe = { return 0xdead & 0xbad; }(); ---

Re: Bug or feature storage class alias

2015-09-26 Thread Freddy via Digitalmars-d
On Saturday, 26 September 2015 at 20:27:03 UTC, Freddy wrote: Is this a bug or a feature Wait nevermind me, the compiler ignores those storage classes if the alias is to a symbol.

Re: Bug or feature storage class alias

2015-09-26 Thread Freddy via Digitalmars-d
On Saturday, 26 September 2015 at 20:27:03 UTC, Freddy wrote: Is this a bug or a feature I forgot to show that sGlobal is writable

Bug or feature storage class alias

2015-09-26 Thread Freddy via Digitalmars-d
Is this a bug or a feature --- import std.stdio; int global; alias cGlobal = const global; alias sGlobal = shared global; void main() { global = 5; writeln(cGlobal); global = 7; writeln(sGlobal); } ---

.h in dmd source code

2015-09-26 Thread Freddy via Digitalmars-d
Under dmd's source code(https://github.com/D-Programming-Language/dmd/tree/master/src) there are some .h files, wasn't dmd supported to converted to D? Why are the .h files still there?

Re: Stroustrup is disappointed with D :(

2015-09-22 Thread Freddy via Digitalmars-d
On Tuesday, 22 September 2015 at 18:58:31 UTC, Tourist wrote: "D disappointed me so much when it went the Java way". https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md#to-do-unclassified-proto-rules It's something about virtual calls, but I didn't understand what he me

Re: Implementing typestate

2015-09-15 Thread Freddy via Digitalmars-d
On Tuesday, 15 September 2015 at 21:44:25 UTC, Freddy wrote: On Tuesday, 15 September 2015 at 17:45:45 UTC, Freddy wrote: Rust style memory management in a library Wait nevermind about that part, it's harder than I thought. All hope might not be lost, something like this MIGHT work,but i'm

Re: Implementing typestate

2015-09-15 Thread Freddy via Digitalmars-d
On Tuesday, 15 September 2015 at 17:45:45 UTC, Freddy wrote: Rust style memory management in a library Wait nevermind about that part, it's harder than I thought.

Re: Implementing typestate

2015-09-15 Thread Freddy via Digitalmars-d
On Tuesday, 15 September 2015 at 18:10:06 UTC, BBasile wrote: Ok, sorry I didn't know this concept so far. So there would be a kind of 'compile-time instance' of File with a modifiable member ? A simplified version of this: https://en.wikipedia.org/wiki/Typestate_analysis Where types can have

Re: Implementing typestate

2015-09-15 Thread Freddy via Digitalmars-d
On Tuesday, 15 September 2015 at 17:45:45 UTC, Freddy wrote: ... I just thought of some corner cases and how to solve them. --- Disallow global variable with typestate (there might be a better solution down the line). The evaluated typestate of variables after going through branches (if,for,

Re: Implementing typestate

2015-09-15 Thread Freddy via Digitalmars-d
On Tuesday, 15 September 2015 at 17:57:10 UTC, BBasile wrote: This won't work in D. Everything that's static is common to each instance. What's possible however is to use an immutable FState that's set in the ctor. --- struct File { immutable FState state, this(string fname, FState s

Implementing typestate

2015-09-15 Thread Freddy via Digitalmars-d
Would it be worth implementing some kind of typestate into the language? By typestate I mean a modifiable enum. For example: --- enum FState { none, read, write } struct File { //maybe another keyword other than enum enum state = FState.none; void openRead(string name)

Rust style memory management

2015-09-12 Thread Freddy via Digitalmars-d
So I saw this video: https://air.mozilla.org/guaranteeing-memory-safety-in-rust/ and was amazed. Is there any way we can implement this in D? What language extensions would be required? My idea on implement this would be to add 3 new pointer (and array) types : [owned,shared immutable,borrow

Re: Member function pointers

2015-09-09 Thread Freddy via Digitalmars-d
On Wednesday, 9 September 2015 at 20:18:06 UTC, Freddy wrote: enum MemberFunc(alias Type, string member) = (ref Type self, Parameters!(__traits(getMember, Type, member)) args) => mixin(q{self.} ~ member ~ q{(args)}); Whoops the alias wasn't needed enum MemberFunc(Type, string member) = (ref T

Re: Member function pointers

2015-09-09 Thread Freddy via Digitalmars-d
On Wednesday, 9 September 2015 at 18:50:45 UTC, Walter Bright wrote: On 6/7/2013 4:21 PM, Manu wrote: So from my dconf talk, I detailed a nasty hack to handle member function pointers in D. https://www.digitalmars.com/articles/b68.html Here's on automatic version import std.traits : Parame

Re: Member function pointers

2015-09-09 Thread Freddy via Digitalmars-d
On Wednesday, 9 September 2015 at 18:55:18 UTC, Walter Bright wrote: On 6/10/2013 7:33 AM, Manu wrote: [...] Sorry to say, your n.g. poster is back to its old tricks :-) On 6/10/2013 That was 2 years ago.

Re: Range functions expand char to dchar

2015-09-09 Thread Freddy via Digitalmars-d
On Tuesday, 8 September 2015 at 18:28:40 UTC, Matt Kline wrote: A bit verbose, but I suppose that will do. You could use map --- import std.algorithm : map; import std.utf : byCodeUnit; import std.array : array; auto arr = ["foo", "bar", "baz"].map!(a => a.byCodeUnit).array; ---

My problem with const

2015-09-04 Thread Freddy via Digitalmars-d
I love the way D does transitive const and immutable but i have a problem when i use const a struct field. --- struct MyStruct { int a; const int b; } struct Range { MyStruct front; void popFront() { front = MyStruct(2, 3); } enum empty = false; } --- This sa

Re: Error reporting is terrible

2015-09-04 Thread Freddy via Digitalmars-d
On Friday, 4 September 2015 at 00:10:46 UTC, Xinok wrote: Again, specific examples would help. Often, when newcomers detail the trouble they encountered during their first experience with D, one or more people will get to work fixing or alleviating the specific issues they mention. Not the op

Re: Object.factory() and exe file size bloat

2015-08-21 Thread Freddy via Digitalmars-d
On Friday, 21 August 2015 at 05:06:47 UTC, Walter Bright wrote: This function: http://dlang.org/phobos/object.html#.Object.factory enables a program to instantiate any class defined in the program. To make it work, though, every class in the program has to have a TypeInfo generated for it.

pragma(mangle) only works on functions

2015-08-16 Thread Freddy via Digitalmars-d
I felt this was important enough to big over to the D general chat. Original Thread:http://forum.dlang.org/thread/zmmsodqrffvcdqidv...@forum.dlang.org BBasile's Example: On Monday, 17 August 2015 at 04:32:47 UTC, BBasile wrote: On Monday, 17 August 2015 at 02:46:02 UTC, Freddy wrote: I can't

[Semi OT] DDT Eclipse Plugin

2015-08-12 Thread Freddy via Digitalmars-d
I just install eclipse with the DDT plugin(https://ddt-ide.github.io/) and it worked well. It has auto complete, dub support(with a minor case senativity bug),and other IDE features.

Re: Algebraic replacement

2015-07-08 Thread Freddy via Digitalmars-d
On Wednesday, 8 July 2015 at 22:19:52 UTC, Freddy wrote: On Wednesday, 8 July 2015 at 21:34:01 UTC, Andrei Alexandrescu wrote: What's unsafe about it? + I meant that it can't be used in @safe code

Re: Algebraic replacement

2015-07-08 Thread Freddy via Digitalmars-d
On Wednesday, 8 July 2015 at 21:34:01 UTC, Andrei Alexandrescu wrote: What's unsafe about it? peek returns a pointer to a stack variable import std.variant; import std.stdio; void main() { Algebraic!(int,string) a = "a"; string* b = a.peek!string; a = 0; writeln(b.length); }

Algebraic replacement

2015-07-08 Thread Freddy via Digitalmars-d
std.variant's Algebraic (https://github.com/D-Programming-Language/phobos/blob/master/std/variant.d) seems very complex for what it's trying to do and is also unsafe. Is it worth writing a simpler replacement? Something like this https://github.com/Superstar64/tagged_union/blob/master/source/t

copying const

2015-06-24 Thread Freddy via Digitalmars-d
I was surprised when this happened, is it a bug or a feature? --- struct A { const int var; } int test() { auto b = A(5); auto c = A(7); pragma(msg, typeof(b)); //A pragma(msg, typeof(c)); //A auto d = b; //compiles b = c; //doesn't compile } --- $ rdmd -main -unittes

Re: ReturnType and overloaded functions

2015-06-12 Thread Freddy via Digitalmars-d
I am curious about the answer myself but there is the workaround of passing the overload through a lambda: import std.traits; int foo(long) { return 0; } short foo(byte) { return 0; } void main() { static assert(is (ReturnType!(() => foo(long.init)) == int)); static assert(is

Type tuple pointers

2015-05-21 Thread Freddy via Digitalmars-d
Why don't pointers and .sizeof work with typetuples import std.typetuple; void main(){ TypeTuple!(int,char)* test; TypeTuple!(long,int).sizeof; } $ rdmd test test.d(3): Error: can't have pointer to (int, char) test.d(4): Error: no property 'sizeof' for tuple '(long, int)' Failed:

Re: Good examples of value types

2015-05-06 Thread Freddy via Digitalmars-d
On Tuesday, 5 May 2015 at 20:40:59 UTC, Luís Marques wrote: Hi, For a comparison with the Java language, I'm trying to come up with some good examples of custom types that should be value types (but that must be ref types in Java). I think the most obvious ones are numeric types. So BigNum, M

std.mmfile is broken

2015-05-05 Thread Freddy via Digitalmars-d
The garbage collector is not required to call class destructors, but Mmfile is a class and could leak memory. http://dlang.org/phobos/std_mmfile.html

Re: Adding a read primitive to ranges

2015-05-05 Thread Freddy via Digitalmars-d
How would it be more optimal? As I said, if you pass in `file.byChunks(some_amount).joiner`, this will still read the file in large chunks. It's less optimal now because `read` has to allocate an array on every call (easily avoidable by passing in a reusable buffer, but still). Equivalent cod

Re: Adding a read primitive to ranges

2015-05-04 Thread Freddy via Digitalmars-d
On Monday, 4 May 2015 at 00:07:27 UTC, Freddy wrote: Would it be a bad idea to add a read primitive to ranges for streaming? struct ReadRange(T){ size_t read(T[] buffer); //and | or T[] read(size_t request); /+ empty,front,popFront,etc +/ } Also if so, What about add

Re: Adding a read primitive to ranges

2015-05-04 Thread Freddy via Digitalmars-d
On Tuesday, 5 May 2015 at 00:50:44 UTC, Freddy wrote: void func(R)(R range){//expects range of strings string[] elms=range.read(5); string[] elms2=range.read(9); /++..++/ } void caller(){ auto file=...;//unbuffered file file.map!(a=>a.to!string).func(); } Wait, Ba

Re: Adding a read primitive to ranges

2015-05-04 Thread Freddy via Digitalmars-d
On Monday, 4 May 2015 at 23:20:57 UTC, Alex Parrill wrote: On Monday, 4 May 2015 at 19:23:08 UTC, Freddy wrote: On Monday, 4 May 2015 at 15:16:25 UTC, Alex Parrill wrote: The ploblem is that all the functions in std.range,std.algorithm and many other wrappers would ignore byChucks and produce

Re: Adding a read primitive to ranges

2015-05-04 Thread Freddy via Digitalmars-d
On Monday, 4 May 2015 at 15:16:25 UTC, Alex Parrill wrote: IT seems redundant to me. It's semantically no different than iterating through the range normally with front/popFront. For objects where reading large amounts of data is more efficient than reading one-at-a-time, you can implement a

Adding a read primitive to ranges

2015-05-03 Thread Freddy via Digitalmars-d
Would it be a bad idea to add a read primitive to ranges for streaming? struct ReadRange(T){ size_t read(T[] buffer); //and | or T[] read(size_t request); /+ empty,front,popFront,etc +/ }

compile time garbage collection

2015-05-02 Thread Freddy via Digitalmars-d
How crazy hard would it be to have a front end optimization pass that would try to replace garbage collector calls with malloc / free?

Re: Closure capture loop variables

2015-04-29 Thread Freddy via Digitalmars-d
On Thursday, 30 April 2015 at 01:19:45 UTC, Vladimir Panteleev wrote: Because "copy" is still modified every time "i" is. But shouldn't copy be redeclared every loop iteration (or the compiler could pretend to redeclare it).

Closure capture loop variables

2015-04-29 Thread Freddy via Digitalmars-d
I understand that import std.stdio; void main(){ int delegate() func; foreach(i;0..10){ if(i==5){ func= () => i; } } writeln(func());//9 } captures the loop variable,but why does import std.stdio

Re: UFCS overrides alias this

2015-04-12 Thread Freddy via Digitalmars-d
On Sunday, 12 April 2015 at 20:35:06 UTC, anonymous wrote: string's empty is actually a function in std.array or std.range or something, called via UFCS. You don't import std's empty, so the call can't match even when the alias this is tried. Add the following, which brings std's empty into th

UFCS overrides alias this

2015-04-12 Thread Freddy via Digitalmars-d
test.d struct A{ string b; alias b this; } struct MyRange{ } char front(MyRange); void popFront(ref MyRange); bool empty(MyRange); void test(A a){ a.empty; } $ dmd -o- test test.d(14): Error: function test.empty (MyRange) is not callable using argument

Re: Filling out the wiki - D as a second language

2015-04-02 Thread Freddy via Digitalmars-d
On Tuesday, 31 March 2015 at 22:25:29 UTC, rumbu wrote: Unfortunately, I cannot edit directly on wiki.dlang.org since my account is not confirmed (confirmation e-mail is not sent despite several attempts). By any chance, do you use gmail? The email sent by the wiki appeared in my gmail's spam.

Re: Can we deprecate "D-style Variadic Functions"

2015-03-27 Thread Freddy via Digitalmars-d
On Friday, 27 March 2015 at 20:57:51 UTC, Freddy wrote: template VariadicFunction(alias Imp){ auto VariadicFunction(T...)(T args){ void* data=&args; TypeInfo[T.length] rtti; foreach(i,type;T){ rtti[i]=typeid(type);

Re: Can we deprecate "D-style Variadic Functions"

2015-03-27 Thread Freddy via Digitalmars-d
On Friday, 27 March 2015 at 19:59:13 UTC, deadalnix wrote: To be fair, this is most likely going to be inlined an ditched away with any decent optimizer. It wouldn't even need alloca if sizeof and address of worked with tuples. ``` template VariadicFunction(alias Imp){ auto VariadicFu

Re: Can we deprecate "D-style Variadic Functions"

2015-03-25 Thread Freddy via Digitalmars-d
On Thursday, 26 March 2015 at 00:11:05 UTC, Dicebot wrote: On Wednesday, 25 March 2015 at 22:12:04 UTC, Freddy wrote: "D-style Variadic Functions" found here:http://dlang.org/function.html seem entirely out classed by Variadic Function Templates. Can we deprecate them? Those are two different

Can we deprecate "D-style Variadic Functions"

2015-03-25 Thread Freddy via Digitalmars-d
"D-style Variadic Functions" found here:http://dlang.org/function.html seem entirely out classed by Variadic Function Templates. Can we deprecate them?

Re: A few notes on choosing between Go and D for a quick project

2015-03-12 Thread Freddy via Digitalmars-d
On Friday, 13 March 2015 at 02:17:31 UTC, bearophile wrote: A "strict D" mode? That sounds like an amazing idea.

Re: Standard GUI framework inspired by Qt

2015-03-03 Thread Freddy via Digitalmars-d
On Tuesday, 3 March 2015 at 22:16:36 UTC, Freddy wrote: On Tuesday, 3 March 2015 at 18:43:50 UTC, Aram wrote: Hi all I've been thinking over a GUI framework for D for some time, and ended up with idea expressed by Andrew Fedoniouk here: http://www.digitalmars.com/d/archives/digitalmars/D/3263

Re: Standard GUI framework inspired by Qt

2015-03-03 Thread Freddy via Digitalmars-d
On Tuesday, 3 March 2015 at 18:43:50 UTC, Aram wrote: Hi all I've been thinking over a GUI framework for D for some time, and ended up with idea expressed by Andrew Fedoniouk here: http://www.digitalmars.com/d/archives/digitalmars/D/32633.html. That is, having a separate drawing layer, and wi

Re: forcing "@nogc" on class destructors

2015-01-20 Thread Freddy via Digitalmars-d
On Tuesday, 20 January 2015 at 18:12:27 UTC, ketmar via Digitalmars-d wrote: Hello. as there is no possibility to doing GC allocations in class destructors, wouldn't it be nice to just force "@nogc" attribute on such dtors? i know, i know, "this will break alot of code". i'm pretty sure that

Re: Improving ddoc

2014-12-31 Thread Freddy via Digitalmars-d
On Wednesday, 31 December 2014 at 21:51:32 UTC, ketmar via Digitalmars-d wrote: On Wed, 31 Dec 2014 11:50:51 -0800 Andrei Alexandrescu via Digitalmars-d wrote: In wake of the recent discussions on improving ddoc syntax we're looking at doing something about it. Please discuss any ideas you

Re: problem with size_t and an easy solution

2014-12-07 Thread Freddy via Digitalmars-d
On Monday, 8 December 2014 at 02:04:58 UTC, ketmar via Digitalmars-d wrote: On Mon, 08 Dec 2014 01:50:44 + Freddy via Digitalmars-d wrote: I would like if usize wasn't implictly convertable to uint or ulong me too, but this change is too radical. it will not break any of my own

Re: problem with size_t and an easy solution

2014-12-07 Thread Freddy via Digitalmars-d
On Monday, 8 December 2014 at 01:30:35 UTC, ketmar via Digitalmars-d wrote: Hello. i don't like `size_t`. for many month i avoied using it wherever that was possible, 'cause i feel something wrong with it. and today i found the soultion! let's see how other D types are named: `int`, `uint`,

Re: std::string responsible for half the allocations in chrome

2014-12-06 Thread Freddy via Digitalmars-d
On Saturday, 6 December 2014 at 16:10:20 UTC, Joseph Rushton Wakeling via Digitalmars-d wrote: On 05/12/14 23:03, deadalnix via Digitalmars-d wrote: http://www.reddit.com/r/programming/comments/2ocmvb/stdstring_is_responsible_for_almost_half_of_all/ Looks like someone need immutable(char)[] .

Re: Do everything in Java…

2014-12-05 Thread Freddy via Digitalmars-d
On Thursday, 4 December 2014 at 13:48:04 UTC, Russel Winder via Digitalmars-d wrote: It's an argument for Java over Python specifically but a bit more general in reality. This stood out for me: !…other languages like D and Go are too new to bet my work on." http://www.teamten.com/lawrence/wr

Re: Scope and Ref and Borrowing

2014-11-17 Thread Freddy via Digitalmars-d
On Friday, 14 November 2014 at 01:21:07 UTC, Walter Bright wrote: Thought I'd bring this up as deadalnix is working on a related proposal. It uses 'scope' in conjunction with 'ref' to resolve some long standing @safe issues. --- **Background The goal of @sa

Re: size_t for length on x64 will make app slower than on x86?

2014-11-17 Thread Freddy via Digitalmars-d
On Monday, 17 November 2014 at 15:28:52 UTC, FrankLike wrote: I test it: module aasize_t; import std.stdio; import std.datetime; import std.conv; import std.string; size_t[string] aa; void gettime() { for(size_t i=0;i<300;i++) { aa[to!string(i)] = i;

Re: Can't pass private symbols as alias parameter

2014-11-16 Thread Freddy via Digitalmars-d
On Sunday, 16 November 2014 at 10:41:20 UTC, deadalnix wrote: module a; struct A(alias foo) { auto foo() { return foo(); } } module b; import a; void main() { auto a = A!bar(); } private int bar() { return 42; } This do not work. I think it is a bug but I see how could s

Why is size_t not a typedef

2014-11-07 Thread Freddy via Digitalmars-d
Why is size_t an alias and not a typedef(or a struct that is not implictly convertable) test.d void main(){ ulong a; size_t b=a;//only compiles on 64-bit } $ dmd -m64 test $ dmd -m32 test test.d(3): Error: cannot implicitly convert expression (a) of type ulong to uint

Re: New reference type designed to handle templates better

2014-11-05 Thread Freddy via Digitalmars-d
On Wednesday, 5 November 2014 at 19:27:59 UTC, Jonathan Marler wrote: I've been thinking about how to handle templates that have typically been using the 'ref' parameter attribute because they modify the parameter. For example, the put/doPut functions in std.range use the 'ref' attribute for t

Re: DIP67: Associative Ranges

2014-10-31 Thread Freddy via Digitalmars-d
On Saturday, 1 November 2014 at 00:04:18 UTC, Jakob Ovrum wrote: On Tuesday, 28 October 2014 at 22:44:32 UTC, Freddy wrote: http://wiki.dlang.org/DIP67 Abstraction over the build-in associative array(one type of range for containers and another type for dynamic generators). Plese criticize.

Re: DIP67: Associative Ranges

2014-10-29 Thread Freddy via Digitalmars-d
On Tuesday, 28 October 2014 at 22:44:32 UTC, Freddy wrote: http://wiki.dlang.org/DIP67 Abstraction over the build-in associative array(one type of range for containers and another type for dynamic generators). Plese criticize. Does any one now a better way to implement lazy associative ranges

Re: DIP67: Associative Ranges

2014-10-29 Thread Freddy via Digitalmars-d
On Wednesday, 29 October 2014 at 19:55:14 UTC, H. S. Teoh via Digitalmars-d wrote: On Wed, Oct 29, 2014 at 06:40:50PM +, Freddy via Digitalmars-d wrote: On Wednesday, 29 October 2014 at 18:04:30 UTC, John Colvin wrote: >On Wednesday, 29 October 2014 at 17:36:41 UTC, H. S. Teoh

Re: DIP67: Associative Ranges

2014-10-29 Thread Freddy via Digitalmars-d
On Wednesday, 29 October 2014 at 18:40:51 UTC, Freddy wrote: On Wednesday, 29 October 2014 at 18:04:30 UTC, John Colvin wrote: On Wednesday, 29 October 2014 at 17:36:41 UTC, H. S. Teoh via Digitalmars-d wrote: On Wed, Oct 29, 2014 at 05:23:07PM +, Brad Anderson via Digitalmars-d wrote: On W

Re: DIP67: Associative Ranges

2014-10-29 Thread Freddy via Digitalmars-d
On Wednesday, 29 October 2014 at 18:04:30 UTC, John Colvin wrote: On Wednesday, 29 October 2014 at 17:36:41 UTC, H. S. Teoh via Digitalmars-d wrote: On Wed, Oct 29, 2014 at 05:23:07PM +, Brad Anderson via Digitalmars-d wrote: On Wednesday, 29 October 2014 at 06:59:09 UTC, bearophile wrote:

DIP67: Associative Ranges

2014-10-28 Thread Freddy via Digitalmars-d
http://wiki.dlang.org/DIP67 Abstraction over the build-in associative array(one type of range for containers and another type for dynamic generators). Plese criticize.

Re: example of pointer usefulness in D

2014-10-21 Thread Freddy via Digitalmars-d
On Tuesday, 21 October 2014 at 12:22:54 UTC, edn wrote: Could someone provide me with examples showing the usefulness of pointers in the D language? They don't seem to be used as much as in C and C++. https://en.wikipedia.org/wiki/XOR_linked_list

compile time configurations

2014-10-08 Thread Freddy via Digitalmars-d
I recently thought of the idea of using string imports for compile time configuration. Something like this --- import std.stdio; import std.conv; import std.range; import std.algorithm; string getVar(string fname,string var)(){ foreach(property;import(fname).splitter('\n')){

Re: RFC: moving forward with @nogc Phobos

2014-09-29 Thread Freddy via Digitalmars-d
On Monday, 29 September 2014 at 10:49:53 UTC, Andrei Alexandrescu wrote: Back when I've first introduced RCString I hinted that we have a larger strategy in mind. Here it is. The basic tenet of the approach is to reckon and act on the fact that memory allocation (the subject of allocators) is

Re: Possible quick win in GC?

2014-09-28 Thread Freddy via Digitalmars-d
On Sunday, 28 September 2014 at 17:47:42 UTC, Abdulhaq wrote: Here's a code snippet which mopefully makes things a bit clearer: /** * In this example the variable foo can be statically analysed as safe to go on the stack. * The new instance of Bar allocated in funcLevelB is only referred to

Re: Library Typedefs are fundamentally broken

2014-09-21 Thread Freddy via Digitalmars-d
On Sunday, 21 September 2014 at 18:24:53 UTC, Freddy wrote: Is this supposed to happen? --- import std.typecons; alias feet=Typedef!(float,0.0,"feet"); alias meter=Typedef!(float,0.0,"meter"); void main(){ feet a=4.0; meter b=5.0; meter c=a*b;//opps pragma(msg,ty

Re: Library Typedefs are fundamentally broken

2014-09-21 Thread Freddy via Digitalmars-d
Is this supposed to happen? --- import std.typecons; alias feet=Typedef!(float,0.0,"feet"); alias meter=Typedef!(float,0.0,"meter"); void main(){ feet a=4.0; meter b=5.0; meter c=a*b;//opps pragma(msg,typeof(c)); } --- $dmd -o- typetest.d Typedef!(float, 0.0F,

Re: Library Typedefs are fundamentally broken

2014-09-16 Thread Freddy via Digitalmars-d
On Wednesday, 17 September 2014 at 03:08:46 UTC, Jakob Ovrum wrote: On Wednesday, 17 September 2014 at 02:57:03 UTC, Freddy wrote: When you have separate 2 typedefs of the exact same type, they are equal.While this maybe able to be solved with Typedef!(Typedef!(...)) different modules typedef in

Library Typedefs are fundamentally broken

2014-09-16 Thread Freddy via Digitalmars-d
When you have separate 2 typedefs of the exact same type, they are equal.While this maybe able to be solved with Typedef!(Typedef!(...)) different modules typedef ing the same type (most likely build-in types) would have their typedef be equivalent thereby degrading the purpose of typedef. --- imp

Re: Increasing D's visibility

2014-09-15 Thread Freddy via Digitalmars-d
On Tuesday, 16 September 2014 at 01:43:15 UTC, Andrei Alexandrescu wrote: My understanding of this situation is different. We've wronged the man in the past and a sign of good will from us would go a long way. Andrei What The D community do wrong in the first place?

Re: Associative Ranges implementation questions

2014-08-08 Thread Freddy via Digitalmars-d
On Saturday, 9 August 2014 at 01:34:38 UTC, Freddy wrote: As of now Associative Ranges are defined as: static assert(isInputRange!R); R r=void; auto v=r.front;//r is an input range static assert(isInputRange!(typeof(r.byKey))); auto k=r.byKey.front;//byKey is an input range static assert(is(

Associative Ranges implementation questions

2014-08-08 Thread Freddy via Digitalmars-d
As of now Associative Ranges are defined as: static assert(isInputRange!R); R r=void; auto v=r.front;//r is an input range static assert(isInputRange!(typeof(r.byKey))); auto k=r.byKey.front;//byKey is an input range static assert(is(typeof(v) ==typeof(r[k]) ));//opIndex of k static assert(is

Re: Associative Ranges

2014-08-04 Thread Freddy via Digitalmars-d
On Monday, 4 August 2014 at 09:21:40 UTC, Marc Schütz wrote: On Sunday, 3 August 2014 at 18:38:51 UTC, Freddy wrote: On Sunday, 3 August 2014 at 08:50:47 UTC, Marc Schütz wrote: 3) For the value and key ranges, there should be a guarantee that they can be zipped through, i.e. that the elements

Re: Associative Ranges

2014-08-04 Thread Freddy via Digitalmars-d
On Tuesday, 5 August 2014 at 00:11:21 UTC, Freddy wrote: On Monday, 4 August 2014 at 09:21:40 UTC, Marc Schütz wrote: On Sunday, 3 August 2014 at 18:38:51 UTC, Freddy wrote: On Sunday, 3 August 2014 at 08:50:47 UTC, Marc Schütz wrote: 3) For the value and key ranges, there should be a guarantee

Re: Associative Ranges

2014-08-04 Thread Freddy via Digitalmars-d
On Monday, 4 August 2014 at 09:21:40 UTC, Marc Schütz wrote: On Sunday, 3 August 2014 at 18:38:51 UTC, Freddy wrote: On Sunday, 3 August 2014 at 08:50:47 UTC, Marc Schütz wrote: 3) For the value and key ranges, there should be a guarantee that they can be zipped through, i.e. that the elements

Re: Associative Ranges

2014-08-03 Thread Freddy via Digitalmars-d
On Sunday, 3 August 2014 at 08:50:47 UTC, Marc Schütz wrote: On Sunday, 3 August 2014 at 06:19:12 UTC, Freddy wrote: On Friday, 1 August 2014 at 23:57:37 UTC, Freddy wrote: I just curious, do Associative Ranges exist. If so where can i find them. I started thinking about them when i asked this

Re: Associative Ranges

2014-08-03 Thread Freddy via Digitalmars-d
On Sunday, 3 August 2014 at 08:50:47 UTC, Marc Schütz wrote: On Sunday, 3 August 2014 at 06:19:12 UTC, Freddy wrote: On Friday, 1 August 2014 at 23:57:37 UTC, Freddy wrote: I just curious, do Associative Ranges exist. If so where can i find them. I started thinking about them when i asked this

Re: Associative Ranges

2014-08-02 Thread Freddy via Digitalmars-d
On Friday, 1 August 2014 at 23:57:37 UTC, Freddy wrote: I just curious, do Associative Ranges exist. If so where can i find them. I started thinking about them when i asked this question: http://forum.dlang.org/thread/vauuognmhvtjrktaz...@forum.dlang.org I started a phobos fork for this, what do

Re: Associative Ranges

2014-08-02 Thread Freddy via Digitalmars-d
On Saturday, 2 August 2014 at 15:46:31 UTC, Xinok wrote: On Saturday, 2 August 2014 at 14:49:49 UTC, bearophile wrote: Xinok: I do wonder if we should generalize an interface for these types of ranges. First of all you need some use cases and usage examples. Bye, bearophile The most obvio

Associative Ranges

2014-08-01 Thread Freddy via Digitalmars-d
I just curious, do Associative Ranges exist. If so where can i find them. I started thinking about them when i asked this question: http://forum.dlang.org/thread/vauuognmhvtjrktaz...@forum.dlang.org