std.net.curl.get failing to resolve google.com

2015-04-21 Thread Jakob Ovrum via Digitalmars-d-learn
test.d --- void main() { import std.net.curl; import std.stdio; writeln(get(http://google.com;)); } --- rdmd -g test.d --- std.net.curl.CurlException@std\net\curl.d(3691): couldn't resolve host name on handle 26B4878 0x0040572A in pure @safe void

std.datetime.parseRFC822DateTime

2015-04-21 Thread Jakob Ovrum via Digitalmars-d-learn
std.datetime contains parseRFC822DateTime to convert from an RFC822/RFC5322 formatted string (ala Sat, 6 Jan 1990 12:14:19 -0800) to a SysTime. Does it contain anything for the converse - converting from a SysTime to Sat, 6 Jan 1990 12:14:19 -0800? If not, should it?

Re: std.datetime.parseRFC822DateTime

2015-04-21 Thread Jakob Ovrum via Digitalmars-d-learn
On Tuesday, 21 April 2015 at 10:28:32 UTC, Jonathan M Davis wrote: On Tuesday, April 21, 2015 08:14:10 Jakob Ovrum via Digitalmars-d-learn wrote: std.datetime contains parseRFC822DateTime to convert from an RFC822/RFC5322 formatted string (ala Sat, 6 Jan 1990 12:14:19 -0800) to a SysTime. Does

Re: Parameter storage class 'in' transitive like 'const'?

2015-05-03 Thread Jakob Ovrum via Digitalmars-d-learn
On Sunday, 3 May 2015 at 05:20:34 UTC, Ali Çehreli wrote: We know that 'in' is equivalent to const scope: http://dlang.org/function.html#parameters So, the constness of 'in' is transitive as well, right? Ali Of course, there's no concept of non-transitive const in D: struct S {

Re: Fuzzy Levenshtein variant of std.conv.to

2015-04-29 Thread Jakob Ovrum via Digitalmars-d-learn
On Wednesday, 29 April 2015 at 14:46:04 UTC, Per Nordlöw wrote: On Tuesday, 28 April 2015 at 23:09:27 UTC, Per Nordlöw wrote: On Tuesday, 28 April 2015 at 16:20:24 UTC, Per Nordlöw wrote: I update my Github repo. I had forgotten to push my latest changes. I solved it. I started working on

Re: Better Return Value for findSplit*()

2015-05-16 Thread Jakob Ovrum via Digitalmars-d-learn
On Saturday, 16 May 2015 at 09:36:30 UTC, Per Nordlöw wrote: After having written a lot of text pattern matching functions using Phobos' findSplit, findSplitBefore, findSplitAfter, and some more I've written myself I've come to the conclusion that I would like to enhance these functions to

Re: Better Return Value for findSplit*()

2015-05-16 Thread Jakob Ovrum via Digitalmars-d-learn
On Saturday, 16 May 2015 at 10:28:11 UTC, Per Nordlöw wrote: Nice! Should I make a PR? I think that would be very welcome.

Re: Run-time Indexing of a Compile-Time Tuple

2015-05-13 Thread Jakob Ovrum via Digitalmars-d-learn
On Tuesday, 12 May 2015 at 13:30:22 UTC, Idan Arye wrote: A little hacky, but how about casting it to a static array? http://dpaste.dzfl.pl/d0059e6e6c09 This PR[1] achieves this without making a copy. [1] https://github.com/D-Programming-Language/phobos/pull/3198

Re: Why is indexed foreach restricted to build in array ?

2015-04-11 Thread Jakob Ovrum via Digitalmars-d-learn
On Saturday, 11 April 2015 at 10:50:17 UTC, matovitch wrote: Hello, The question is in the title. It should be possible for a finite random access ranges to perform an indexed foreach no ? I mean like : foreach(size_t i = 0, auto ref x; R) { /*...*/ } Why are other foreach statements

Re: Why is indexed foreach restricted to build in array ?

2015-04-11 Thread Jakob Ovrum via Digitalmars-d-learn
On Saturday, 11 April 2015 at 12:04:06 UTC, matovitch wrote: well ldc doesn't compile : kmeans.d(40): Error: no property 'enumerate' for type 'Range' With -O -release -inline I get around 2s with foreach and 0.5s with a simple for. LDC does not yet support the 2.067 front-end version in

Re: std.range.only with different range types

2015-11-08 Thread Jakob Ovrum via Digitalmars-d-learn
On Sunday, 8 November 2015 at 19:57:34 UTC, Freddy wrote: --- import std.algorithm; import std.range; import std.stdio; void main(){ only(iota(0,4),[1,4,5]).writeln; } --- How can I call std.range.only with different range types? `only` is for creating a range from a list of values.

Re: LDC 0.17.0 alpha cross-compiler for Android/ARM, D 2.068.2

2015-11-11 Thread Jakob Ovrum via Digitalmars-d-announce
On Saturday, 7 November 2015 at 18:39:22 UTC, Joakim wrote: OK, I've rebuilt ldc with one small tweak: I've added the current directory to its rpath and bundled my system libconfig along with it, which is what the official ldc release does too. You shouldn't need libconfig installed by your

Re: Bidirectional Filter

2015-11-03 Thread Jakob Ovrum via Digitalmars-d-learn
On Tuesday, 3 November 2015 at 08:41:11 UTC, Nordlöw wrote: Is there a reason why std.algorithm.iteration.filter() doesn't propagate bidirectional access? http://dlang.org/phobos/std_algorithm_iteration.html#filterBidirectional

Re: Unionize range types

2015-11-02 Thread Jakob Ovrum via Digitalmars-d-learn
On Tuesday, 3 November 2015 at 01:55:27 UTC, Freddy wrote: Is there any way I can Unionize range Types? --- auto primeFactors(T)(T t, T div = 2) { if (t % div == 0) { return t.only.chain(primeFactors(t / div, div)); } if (div > t) { return []; } else

Re: Is it possible to filter variadics?

2015-11-03 Thread Jakob Ovrum via Digitalmars-d-learn
On Tuesday, 3 November 2015 at 23:41:10 UTC, maik klein wrote: Is it possible to filter variadics for example if I would call void printSumIntFloats(Ts...)(Ts ts){...} printSumIntFloats(1,1.0f,2,2.0f); I want to print the sum of all integers and the sum of all floats. //Pseudo code void

Re: LDC 0.17.0 alpha cross-compiler for Android/ARM, D 2.068.2

2015-11-06 Thread Jakob Ovrum via Digitalmars-d-announce
On Friday, 6 November 2015 at 20:24:18 UTC, Joakim wrote: On Friday, 6 November 2015 at 20:10:36 UTC, Jakob Ovrum wrote: On Friday, 6 November 2015 at 11:56:35 UTC, Joakim wrote: [...] Thanks for the thorough instructions! LLVM is rather massive and I'd prefer to avoid building it if I can,

Re: LDC 0.17.0 alpha cross-compiler for Android/ARM, D 2.068.2

2015-11-06 Thread Jakob Ovrum via Digitalmars-d-announce
On Friday, 6 November 2015 at 11:56:35 UTC, Joakim wrote: https://github.com/joakim-noah/android/releases/tag/runners You will need a linux/x86 host and the Android NDK, optionally the SDK if you want to create a GUI app. A slightly older build was used to create the test runners from

Re: Is it possible to filter variadics?

2015-11-04 Thread Jakob Ovrum via Digitalmars-d-learn
On Wednesday, 4 November 2015 at 09:48:40 UTC, maik klein wrote: Thanks, that is exactly what I wanted to achieve. What is the performance implication of 'only' in this context? Will it copy all arguments? Yes, it will, but just from the stack to a different location on stack.

Re: LuaD: creating a flexible data filter system

2015-10-16 Thread Jakob Ovrum via Digitalmars-d-learn
On Friday, 16 October 2015 at 09:01:57 UTC, yawniek wrote: hi, i'm reading in a stream of data that is deserialized into individual frames. a frame is either of: a) a specific D datastructure ( struct with a few ulong,string,string[string] etc members), known at compile time b) json

Re: LuaD: creating a flexible data filter system

2015-10-16 Thread Jakob Ovrum via Digitalmars-d-learn
On Friday, 16 October 2015 at 10:45:52 UTC, Chris wrote: Later you call the function with the Lua C API like "lua_pcall(L, 0, 1, 0);". It's a bit tricky to move things around on the Lua stack, but you'll get there! ;) Or you could use LuaD which doesn't require you to mess around with the

Re: Why can't function expecting immutable arg take mutable input?

2015-10-16 Thread Jakob Ovrum via Digitalmars-d-learn
On Saturday, 17 October 2015 at 02:03:01 UTC, Shriramana Sharma wrote: Ali Çehreli wrote: http://ddili.org/ders/d.en/const_and_immutable.html#ix_const_and_immutable.parameter, %20const%20vs.%20immutable Hi Ali – I take this chance to personally thank you sincerely for your book which

Re: Calling D from C, C++, Python…

2015-09-13 Thread Jakob Ovrum via Digitalmars-d-learn
On Thursday, 10 September 2015 at 18:01:10 UTC, Russel Winder wrote: Is there an easy way of knowing when you do not have to initialize the D runtime system to call D code from, in this case, Python via a C adapter? I naïvely transformed some C++ to D, without consideration of D runtime

Re: Calling D from C, C++, Python…

2015-09-13 Thread Jakob Ovrum via Digitalmars-d-learn
On Sunday, 13 September 2015 at 10:10:32 UTC, Jakob Ovrum wrote: On Thursday, 10 September 2015 at 18:01:10 UTC, Russel Winder wrote: Is there an easy way of knowing when you do not have to initialize the D runtime system to call D code from, in this case, Python via a C adapter? I naïvely

Re: best way to memoize a range?

2015-09-11 Thread Jakob Ovrum via Digitalmars-d-learn
On Friday, 11 September 2015 at 13:09:33 UTC, Laeeth Isharc wrote: obviously it's trivial to do with a little aa cache. and I know I can memoize a function, and turn the memoized version into an infinite range. but suppose I have a lazy function that returns a finite range, and its expensive

Re: Why do abstract class functions require definitions?

2015-09-18 Thread Jakob Ovrum via Digitalmars-d-learn
On Friday, 18 September 2015 at 13:18:23 UTC, Jacob Carlborg wrote: On 2015-09-16 12:36, Marc Schütz wrote: Wouldn't the following behaviour be more useful as a default? abstract class Foo { void bar1() { } // non-abstract, obviously void bar2();// abstract,

Re: Reset all Members of a Aggregate Instance

2015-12-05 Thread Jakob Ovrum via Digitalmars-d-learn
On Saturday, 5 December 2015 at 16:28:18 UTC, Chris Wright wrote: The default constructor doesn't set default field values, though, which is why my solution involved copying ClassInfo.init. Thanks, this is a handy factoid. Reminds me of the whole __dtor vs __xdtor debacle.

Re: Reset all Members of a Aggregate Instance

2015-12-03 Thread Jakob Ovrum via Digitalmars-d-learn
On Thursday, 3 December 2015 at 21:04:00 UTC, Nordlöw wrote: Given class C { // lots of members } and a function f(C c) { } is there a generic way, perhaps through reflection, to reset (inside f) all members of `c` to their default values? Something along

Re: No documentation for core.sys?

2015-12-16 Thread Jakob Ovrum via Digitalmars-d-learn
On Thursday, 17 December 2015 at 03:40:02 UTC, Shriramana Sharma wrote: In my recent search for D's equivalent of isatty, I found out that there is a core.sys.posix module only by rgrepping under /usr/include/dmd. Why isn't there a documentation page http://dlang.org/phobos/core_sys.html

Re: Using a struct as a wrapper for an extern(C) opaque type, no default constructor, what do?

2015-12-16 Thread Jakob Ovrum via Digitalmars-d-learn
On Thursday, 17 December 2015 at 04:05:30 UTC, Jeremy DeHaan wrote: http://dpaste.com/3FH3W13 Also, I would be wary of lazy initialization. We have bad experiences with it for AAs and standard containers. A typical example would be: void foo(Wrapper w) { ... w.doTheThing(); ...

Re: Using a struct as a wrapper for an extern(C) opaque type, no default constructor, what do?

2015-12-16 Thread Jakob Ovrum via Digitalmars-d-learn
On Thursday, 17 December 2015 at 04:05:30 UTC, Jeremy DeHaan wrote: Thanks. I guess what bugs me is that I always try to hide the fact that the API is a wrapper around C stuff, ie, I want to make people feel as though they're using idiomatic D. Doing something like this makes it feel like less

Re: Using a struct as a wrapper for an extern(C) opaque type, no default constructor, what do?

2015-12-16 Thread Jakob Ovrum via Digitalmars-d-learn
On Thursday, 17 December 2015 at 06:04:14 UTC, Jeremy DeHaan wrote: And I guess what I was talking about before is that using a factory method feels klunky to me. If the things I am wrapping had been written in D they could use default initialization, so it feels wrong to do otherwise. I also

Re: No documentation for core.sys?

2015-12-16 Thread Jakob Ovrum via Digitalmars-d-learn
On Thursday, 17 December 2015 at 04:23:30 UTC, Shriramana Sharma wrote: Jakob Ovrum wrote: As with core.stdc, refer to the documentation for the equivalent C header. I only know of even core.stdc's existence since I've been poking into the Phobos sources. At least the Phobos documentation

Re: Testing if a file is connected to a terminal

2015-12-16 Thread Jakob Ovrum via Digitalmars-d-learn
On Thursday, 17 December 2015 at 04:05:57 UTC, Adam D. Ruppe wrote: On Thursday, 17 December 2015 at 03:59:27 UTC, Jakob Ovrum wrote: There are some terminal libraries on Github (like consoled) but I have to say I think they're uninspiring in terms of quality and presentation. Can you be any

Re: exit(1)?

2015-12-16 Thread Jakob Ovrum via Digitalmars-d-learn
On Thursday, 17 December 2015 at 05:02:50 UTC, Shriramana Sharma wrote: http://dlang.org/phobos/std_getopt.html has a line in an example saying exit(1); Surely this works only if core.stdc.stdlib is imported? Should the example be modified to show the import? And is exit() the canonical way

Re: Using a struct as a wrapper for an extern(C) opaque type, no default constructor, what do?

2015-12-16 Thread Jakob Ovrum via Digitalmars-d-learn
On Thursday, 17 December 2015 at 03:31:37 UTC, Jeremy DeHaan wrote: Hi all. I'm interfacing to some C code which include an opaque type and some C functions that create and work with a pointer to that type. I want to wrap up everything in a struct, and the only thing that seems to bug me is

Re: isBidirectionalRange fails for unknown reasons

2015-12-16 Thread Jakob Ovrum via Digitalmars-d-learn
On Wednesday, 16 December 2015 at 20:43:02 UTC, Jack Stouffer wrote: ... You can also use return type covariance: class ReferenceBidirectionalRange(T) : ReferenceForwardRange!T { this(Range)(Range r) if (isInputRange!Range) { super(r); } final override @property typeof(this) save() {

Re: Testing if a file is connected to a terminal

2015-12-16 Thread Jakob Ovrum via Digitalmars-d-learn
On Thursday, 17 December 2015 at 03:38:31 UTC, Shriramana Sharma wrote: Is there a canonical way to test in D whether stdout/stderr (or in general, a std.stdio.File) refers to a terminal or not? https://www.google.co.in/search?q=terminal=dlang.org/phobos turns out nothing. I knew of C's (or

Re: exit(1)?

2015-12-17 Thread Jakob Ovrum via Digitalmars-d-learn
On Thursday, 17 December 2015 at 07:33:36 UTC, Jacob Carlborg wrote: I agree with that, but why don't the runtime register a function with "atexit" that cleans up everything? I think it might be possible, but it doesn't sound trivial. In particular, all threads and fibers managed by druntime

Re: Binary search

2015-12-14 Thread Jakob Ovrum via Digitalmars-d-learn
On Tuesday, 15 December 2015 at 00:22:37 UTC, tsbockman wrote: I also found `SortedRange.equalRange`, but that sounds like it has an unreasonable amount of (admittedly O(1)) overhead for the (extremely common) case in which I am looking for only a single element, not a range. If your array

Balanced match with std.regex

2015-12-14 Thread Jakob Ovrum via Digitalmars-d-learn
Is there a way to do balanced match with std.regex? Example (from [1]): test -> funcPow((3),2) * (9+1) I want to match the funcPow((3),2) bit, regardless of the depth of the expression in funcPow(*). https://stackoverflow.com/questions/7898310/using-regex-to-balance-match-parenthesis [1]

Re: Binary search

2015-12-14 Thread Jakob Ovrum via Digitalmars-d-learn
On Tuesday, 15 December 2015 at 00:31:45 UTC, Jakob Ovrum wrote: For sorted arrays you won't find any other standard facility for doing binary search, but the containers RedBlackTree and BinaryHeap provide something related. You could also get the upper bound (SortedRange.upperBound) and

Re: Balanced match with std.regex

2015-12-14 Thread Jakob Ovrum via Digitalmars-d-learn
On Tuesday, 15 December 2015 at 01:07:32 UTC, Chris Wright wrote: I don't think so. std.regex looks like it implements only a deterministic finite automaton, whereas what you are looking for requires a push-down automaton. It just so happens that a few popular regex libraries implement PDAs

Re: C string to D without memory allocation?

2015-12-20 Thread Jakob Ovrum via Digitalmars-d-learn
On Monday, 21 December 2015 at 06:00:45 UTC, Shriramana Sharma wrote: I suppose what you mean is, the onus of guaranteeing that const(char)* refers to a null-terminated string is upon the person calling the to! function? Yes I understand, and Phobos documentation does say that using a pointer

Re: C string to D without memory allocation?

2015-12-20 Thread Jakob Ovrum via Digitalmars-d-learn
On Monday, 21 December 2015 at 05:41:31 UTC, Shriramana Sharma wrote: Rikki Cattermole wrote: string myCString = cast(string)ptr[0 .. strLen]; Thanks but does this require that one doesn't attempt to append to the returned string using ~= or such? In which case it is not safe, right?

Re: C string to D without memory allocation?

2015-12-20 Thread Jakob Ovrum via Digitalmars-d-learn
On Monday, 21 December 2015 at 05:34:07 UTC, Shriramana Sharma wrote: Hello. I have the following code: import std.stdio, std.conv; extern(C) const(char) * textAttrN(const (char) * specString, size_t n); string textAttr(const(char)[] specString) { const(char) * ptr =

Re: function without "this" cannot be const?

2015-12-20 Thread Jakob Ovrum via Digitalmars-d-learn
On Monday, 21 December 2015 at 02:03:14 UTC, Shriramana Sharma wrote: I'm trying to interface to a C function: extern(C) const char * textAttrN(const char * specString, size_t n); and getting the error: Error: function .textAttrN without 'this' cannot be const Please advise as to what I'm

Re: C string to D without memory allocation?

2015-12-20 Thread Jakob Ovrum via Digitalmars-d-learn
On Monday, 21 December 2015 at 05:39:32 UTC, Rikki Cattermole wrote: size_t strLen = ...; char* ptr = ...; string myCString = cast(string)ptr[0 .. strLen]; I can't remember if it will include the null terminator or not, but if it does just decrease strLen by 1. Strings from C libraries

Re: C string to D without memory allocation?

2015-12-20 Thread Jakob Ovrum via Digitalmars-d-learn
On Monday, 21 December 2015 at 05:43:04 UTC, Rikki Cattermole wrote: On 21/12/15 6:41 PM, Shriramana Sharma wrote: Rikki Cattermole wrote: string myCString = cast(string)ptr[0 .. strLen]; Thanks but does this require that one doesn't attempt to append to the returned string using ~= or

Re: Most performant way of converting int to string

2015-12-23 Thread Jakob Ovrum via Digitalmars-d-learn
On Tuesday, 22 December 2015 at 17:23:11 UTC, Andrew Chapman wrote: On Tuesday, 22 December 2015 at 17:18:16 UTC, cym13 wrote: On Tuesday, 22 December 2015 at 17:15:27 UTC, Andrew Chapman wrote: Sorry if this is a silly question but is the to! method from the conv library the most efficient

Re: Most performant way of converting int to string

2015-12-23 Thread Jakob Ovrum via Digitalmars-d-learn
On Wednesday, 23 December 2015 at 11:21:32 UTC, Jakob Ovrum wrote: Dynamic memory allocation is expensive. If the string is short-lived, allocate it on the stack: See also std.conv.toChars[1] for stringifying lazily/on-demand. http://dlang.org/phobos/std_conv#toChars

Re: Ranges: How to take N last of elements of range

2015-12-27 Thread Jakob Ovrum via Digitalmars-d-learn
On Saturday, 26 December 2015 at 05:31:59 UTC, Ur@nuz wrote: On Friday, 25 December 2015 at 20:06:04 UTC, drug wrote: 25.12.2015 17:13, Ur@nuz пишет: [...] You can do following http://dpaste.dzfl.pl/41c57f89a5a0 The reason of compile error is your using a range as a separator, change it

Re: C string to D without memory allocation?

2015-12-21 Thread Jakob Ovrum via Digitalmars-d-learn
On Monday, 21 December 2015 at 08:35:22 UTC, Jonathan M Davis wrote: There's also fromStringz that Jakob suggests using elsewhere in this thread, but that really just boils down to return cString ? cString[0 .. strlen(cString)] : null; So, using that over simply slicing is primarily for

Re: Multiple selective imports on one line

2015-12-23 Thread Jakob Ovrum via Digitalmars-d-learn
On Wednesday, 23 December 2015 at 10:51:52 UTC, earthfront wrote: I'm using hackerpilot's excellent textadept plugin + DCD, Dfmt, and Dscanner. Upon saving files, it produces suggestions, much like warnings from the compiler. One suggestion is to use selective imports in local scopes. OK,

Re: What's going to replace std.stream?

2016-02-06 Thread Jakob Ovrum via Digitalmars-d-learn
On Saturday, 6 February 2016 at 06:29:56 UTC, cy wrote: Let's say I have a socket, and a file, and I want to send the contents of that file to the socket. What's the best way to do that? Yes I'm aware that in Linux, you can use a combination of a pipe and splice(2) to keep all buffers kernel

Re: Printing a C "string" with write(f)ln

2016-02-09 Thread Jakob Ovrum via Digitalmars-d-learn
On Tuesday, 9 February 2016 at 12:46:59 UTC, Whirlpool wrote: Hello, When you are using a C function (from an external library) that returns a pointer on char which is the beginning of a string (I know that C does not have a string type, that they are just arrays of chars ended by '\0'), is

Re: Printing a C "string" with write(f)ln

2016-02-09 Thread Jakob Ovrum via Digitalmars-d-learn
On Tuesday, 9 February 2016 at 16:52:09 UTC, Gary Willoughby wrote: On Tuesday, 9 February 2016 at 12:50:27 UTC, Jakob Ovrum wrote: writefln et al sensibly does *not* assume that a pointer to char is a C string, for memory safety purposes. Print the result of std.string.fromStringz[1]

Re: How do you pass in a static array by reference?

2016-02-07 Thread Jakob Ovrum via Digitalmars-d-learn
On Monday, 8 February 2016 at 05:59:43 UTC, Enjoys Math wrote: I have several class members: Arc[4] arcs; Arc[4] arcs_2; and Id like to initialize them with the same function, so how do I "pass them in" by reference? void foo(ref Arc[4] arr) { … } The dimension can of course be

Re: How do you pass in a static array by reference?

2016-02-07 Thread Jakob Ovrum via Digitalmars-d-learn
On Monday, 8 February 2016 at 06:01:24 UTC, Jakob Ovrum wrote: On Monday, 8 February 2016 at 05:59:43 UTC, Enjoys Math wrote: I have several class members: Arc[4] arcs; Arc[4] arcs_2; and Id like to initialize them with the same function, so how do I "pass them in" by reference? void

Re: D Article: Memory Safety

2016-01-20 Thread Jakob Ovrum via Digitalmars-d-announce
On Wednesday, 20 January 2016 at 20:28:03 UTC, Jon D wrote: This is passes the @safe constraint, but 'stdout.writeln()' and 'stderr.writeln()' do not. (My program uses stderr.) stderr/stdout/stdin are __gshared and can't be referenced by safe code. The module level version of writeln, etc.,

Re: D Article: Memory Safety

2016-01-20 Thread Jakob Ovrum via Digitalmars-d-announce
On Wednesday, 20 January 2016 at 19:55:45 UTC, H. S. Teoh wrote: On Wed, Jan 20, 2016 at 07:25:43PM +, Dicebot via Digitalmars-d-announce wrote: `auto p = () @trusted { return } ();` Huh, I thought Andrei was opposed to this idiom? Is it now considered reserved for templates or something

Re: D Article: Memory Safety

2016-01-20 Thread Jakob Ovrum via Digitalmars-d-announce
On Wednesday, 20 January 2016 at 15:28:05 UTC, jmh530 wrote: I like the description of @trusted and template inference. Template inference, in particular, was not something that was obvious to me when first reading about D. I'm not sure how clear you make it that you can still mark templates

Re: D Article: Memory Safety

2016-01-21 Thread Jakob Ovrum via Digitalmars-d-announce
On Wednesday, 20 January 2016 at 14:04:53 UTC, Jakob Ovrum wrote: snip Thanks for all the feedback. I've pushed a revision with further changes, most of it based on the feedback in this thread.

Re: D Article: Memory Safety

2016-01-21 Thread Jakob Ovrum via Digitalmars-d-announce
On Thursday, 21 January 2016 at 13:39:48 UTC, Dicebot wrote: I'd suggest at the very least to add a comment before "p.bar();" saying "Must not escape 'p' pointer or @safe-ty will be compromised". I thought about this case, but it relies on UFCS which is controlled by the callee. The caller

Re: D Article: Memory Safety

2016-01-21 Thread Jakob Ovrum via Digitalmars-d-announce
On Thursday, 21 January 2016 at 13:52:57 UTC, Dicebot wrote: Reasonable, but the UFCS call can result from some other function defined in same module (Phobos modules are not small at all). Even small unlikely violation can completely destroy benefits of @safe so in my opinion one can't be

Re: D Article: Memory Safety

2016-01-20 Thread Jakob Ovrum via Digitalmars-d-announce
On Thursday, 21 January 2016 at 06:20:01 UTC, rsw0x wrote: okay, I'll just use @safe here... and nothing else in third party libraries/half of phobos is @safe friendly so I guess I'll wrap it in @trusted oh fuck it Yeah, using @trusted like that is counterproductive. Just use @system or

Re: Types as keys

2016-01-26 Thread Jakob Ovrum via Digitalmars-d-learn
On Tuesday, 26 January 2016 at 15:54:14 UTC, Voitech wrote: How to handle this correctly? Make BaseParser the value type of the AA. Parser!Foo and Parser!Bar are subtypes of BaseParser. Unlike Java, just `Parser` is not a type but a template. It must be instantiated to create a type. Java

D Article: Memory Safety

2016-01-20 Thread Jakob Ovrum via Digitalmars-d-announce
The article aims to explain how to use @safe, @system and importantly, @trusted, including all the hairy details of templates. https://jakobovrum.github.io/d/2016/01/20/memory-safety.html Any and all feedback appreciated.

dlang.org Re-Design Dark Theme

2016-03-14 Thread Jakob Ovrum via Digitalmars-d-announce
Hello, Here's a light-on-dark theme userstyle for the recent dlang.org re-design: https://gist.github.com/JakobOvrum/e00f97f30bba4b24b6bc The front page looks like this: https://i.imgur.com/zuwVu7r.png The theme supports the front page, articles, language specification, Phobos

Re: dlang.org Re-Design Dark Theme

2016-03-14 Thread Jakob Ovrum via Digitalmars-d-announce
On Monday, 14 March 2016 at 16:42:27 UTC, Russel Winder wrote: Is this intended as a Stylist style option for the site? Yeah, I just don't want to bother with authenticating on their site right now. Feel free to submit it if you'd like to see it there. I don't know how maintenance/updating

Re: dlang.org Re-Design Dark Theme

2016-03-14 Thread Jakob Ovrum via Digitalmars-d-announce
On Monday, 14 March 2016 at 13:25:02 UTC, Nordlöw wrote: On Monday, 14 March 2016 at 12:00:24 UTC, Jakob Ovrum wrote: Suggestions, forks, uploads to Stylish and so forth are all welcome. The important part is that we have an alternative that is nice on the eyes for us who use dark-coloured

<    1   2   3