Re: Why don't you advertise more your language on Quora etc ?

2017-03-02 Thread sarn via Digitalmars-d
On Thursday, 2 March 2017 at 15:32:26 UTC, bachmeier wrote: On Thursday, 2 March 2017 at 11:10:54 UTC, Martin Tschierschke wrote: I started to learn programming (BASIC) with an traditional home computer in the 80's (Schneider/Amstrad CPC6128). The best thing was, you only needed to switch it

Re: How to enforce compile time evaluation (and test if it was done at compile time)

2017-02-28 Thread sarn via Digitalmars-d-learn
On Tuesday, 28 February 2017 at 07:41:36 UTC, Christian Köstlin wrote: As I understand the only difference between assert and enforce is, that assert is not compiled into releases? Thanks! Christian Pretty much so. The intention is that assert means something that's supposed to be true

Re: How to enforce compile time evaluation (and test if it was done at compile time)

2017-02-27 Thread sarn via Digitalmars-d-learn
On Tuesday, 28 February 2017 at 00:20:05 UTC, sarn wrote: On Monday, 27 February 2017 at 19:26:06 UTC, Christian Köstlin wrote: How can I make sure, that the calculations are done at compile time? If you ever have doubts, you can always use something like this to check: assert (__ctfe);

Re: How to enforce compile time evaluation (and test if it was done at compile time)

2017-02-27 Thread sarn via Digitalmars-d-learn
On Monday, 27 February 2017 at 19:26:06 UTC, Christian Köstlin wrote: How can I make sure, that the calculations are done at compile time? If you ever have doubts, you can always use something like this to check: assert (__ctfe);

Re: Hello, folks! Newbie to D, have some questions!

2017-02-18 Thread sarn via Digitalmars-d-learn
On Saturday, 18 February 2017 at 21:09:20 UTC, ag0aep6g wrote: Also, some threads online mention that if we do turn off GC, some of the core std libraries may not fully work. Is this presumption also correct? Yes. Whenever a std function returns a new string or some such it's going to be

Re: Hello, folks! Newbie to D, have some questions!

2017-02-18 Thread sarn via Digitalmars-d-learn
On Saturday, 18 February 2017 at 20:15:55 UTC, timmyjose wrote: Hello folks, Hi :) 2. I am more interested in learning D as a pure systems programming language so that I can develop my own tools (not looking to develop an OS, just some grep-scale tools to start off with). In that regard, I

Re: Why do static arrays affect executable size?

2017-02-10 Thread sarn via Digitalmars-d-learn
On Friday, 10 February 2017 at 15:12:28 UTC, Jonathan M Davis wrote: Module-level and static variables all get put in the executable. So, declaring a static array like that is going to take up space. A dynamic array would do the same thing if you gave it a value of that size. The same thing

Re: Multiplayer Game Project

2017-02-09 Thread sarn via Digitalmars-d
I do consulting based in Sydney. Feel free to contact me if you ever need any more help. s...@theartofmachinery.com

Re: capture stdout or stderr

2017-02-02 Thread sarn via Digitalmars-d-learn
On Wednesday, 1 February 2017 at 01:08:19 UTC, Emil wrote: is it possible to intercept the STDOUT or STDERR and capture the output into a variable ? some pseudocode to explain what I mean string[] output_buffer; stdout.capture_to(output_buffer); writeln("test 1"); # not printed

Re: Safely moving structs in D

2017-01-23 Thread sarn via Digitalmars-d-learn
On Monday, 23 January 2017 at 22:26:58 UTC, bitwise wrote: Is it ok to memcpy/memmove a struct in D? Quote from here: https://dlang.org/spec/garbage.html "Do not have pointers in a struct instance that point back to the same instance. The trouble with this is if the instance gets moved in

Re: General performance tips

2017-01-23 Thread sarn via Digitalmars-d-learn
On Monday, 23 January 2017 at 12:13:30 UTC, albert-j wrote: Well it is actually ODE solver from Numerical recipes (originally in C++) that I am trying to do in D. Code translation seems very straightforward. Maybe there's someone around who has done that already? There's not much object

Re: Linker-hacking out the D runtime

2017-01-09 Thread sarn via Digitalmars-d-announce
On Monday, 9 January 2017 at 13:42:01 UTC, Mike wrote: On Sunday, 8 January 2017 at 22:14:36 UTC, Iain Buclaw wrote: 1) -fno-rtti should be a flag that is honoured by the compiler. The more I think about it the more I dislike the whole idea of -fno-rtti. All I've ever wanted from the D

Re: Beta D 2.072.2-b1

2016-12-27 Thread sarn via Digitalmars-d-announce
On Tuesday, 27 December 2016 at 04:36:54 UTC, Martin Nowak wrote: -fPIC became default for all linux 64-bit binaries and packages in order to support PIE (default on Ubuntu 16.10 and hardened Gentoo). AFAIK, the only way to disable PIC for a specific build is to use a local dmd.conf that

Re: Improvement in pure functions specification

2016-12-20 Thread sarn via Digitalmars-d
On Wednesday, 21 December 2016 at 02:27:02 UTC, Andrei Alexandrescu wrote: If it's elidable, it's as good as a bug in the program. Must be either a compile-time error or a special case. -- Andrei I can't see it ending well to make it this kind of special case. For example, one day someone

Re: Linker-hacking out the D runtime

2016-12-18 Thread sarn via Digitalmars-d-announce
On Sunday, 18 December 2016 at 02:37:22 UTC, Mike wrote: I abandoned D sometime ago largely because of https://issues.dlang.org/show_bug.cgi?id=14758 (but there were other reasons), so your blog post is interesting to me. It is unfortunate that we have to resort to such hackery, but its nice

Re: Linux Kernel in D?

2016-12-17 Thread sarn via Digitalmars-d
On Friday, 16 December 2016 at 16:12:38 UTC, D.Rex wrote: A D port of the Linux Kernel? https://github.com/whatsthisnow/ProjectD Any thoughts on the project? Depends on how strictly you want to reimplement GNU/Linux, or whether something Posix-y is enough. Anyway, a D "libc" would be

Linker-hacking out the D runtime

2016-12-17 Thread sarn via Digitalmars-d-announce
As it stands, the -betterC flag is still immature and only removes a bit of the D runtime. I've been playing around a bit to see what could be possible. To do that, I've had to do some linker hacking to make code that's completely free of D runtime dependencies. I thought I'd write

Re: From r/linux: Which language should i use/learn ?

2016-12-11 Thread sarn via Digitalmars-d
On Saturday, 10 December 2016 at 22:55:22 UTC, Chris Wright wrote: It's always a bit weird when people talk about "resources" as a unification of memory, files, sockets, etc. My programs exist to fill memory and then push bits of memory around. At least 99% of my "resource" usage is heap

Re: [Semi-OT] I don't want to leave this language!

2016-12-05 Thread sarn via Digitalmars-d-learn
On Monday, 5 December 2016 at 17:18:25 UTC, e-y-e wrote: Currently I have been learning D for about a year and a half. This may seem like a short time, but this is the longest I have stuck with any language. I have only been learning for 4 years and I am currently in university studying first

Re: Sockets and using them...

2016-11-06 Thread sarn via Digitalmars-d-learn
On Sunday, 6 November 2016 at 06:02:48 UTC, Era Scarecrow wrote: So I've got a project where I want to create basically a decentralized chat program where every program is a host and a client. When you connect all connections can go through to route the chat to everyone else. So to make

Re: Calling std.variant.visit from a pure function

2016-11-04 Thread sarn via Digitalmars-d-learn
On Friday, 4 November 2016 at 02:56:07 UTC, Paul Backus wrote: When I compile this (using DMD 2.069 on Debian Linux), I get an error saying that I can't call visit from a pure function. This is surprising, since all visit does (in theory) is call the provided functions, and all of _them_ are

Re: general questions about static this() at module level

2016-10-30 Thread sarn via Digitalmars-d-learn
On Monday, 31 October 2016 at 04:35:35 UTC, WhatMeWorry wrote: First, are there any other languages that has this feature? The few I know, certainly don't. I've seen hacks to do the same thing in C++. They're not pretty, though. And how would you compare and contrast these this(s) with

Re: Parse a String given some delimiters

2016-10-30 Thread sarn via Digitalmars-d-learn
On Sunday, 30 October 2016 at 20:50:47 UTC, Alfred Newman wrote: Hello, I'm migrating some Python code to D, but I stuck at a dead end... Sorry to provide some .py lines over here, but I got some doubts about the best (fastest) way to do that in D. The "splitter" generic function sounds

Re: Linus' idea of "good taste" code

2016-10-26 Thread sarn via Digitalmars-d
On Wednesday, 26 October 2016 at 10:48:34 UTC, Marco Leise wrote: On a more controversial note, I sometimes replace nested blocks of conditionals and loops with flat spaghetti code and goto with verbose labels. There are situations where you can explain straight forward what needs to be done

Re: Tuple enhancement

2016-10-16 Thread sarn via Digitalmars-d
On Sunday, 16 October 2016 at 13:58:51 UTC, Andrei Alexandrescu wrote: I was thinking it would be handy if tuples had a way to access a field by name at runtime. E.g.: Tuple!(int, "a", double, "b") t; string x = condition ? "a" : "b"; double v = t.get!string(x, 3.14); The get method takes the

Re: New encryption block...

2016-10-10 Thread sarn via Digitalmars-d
On Monday, 10 October 2016 at 09:54:32 UTC, Era Scarecrow wrote: The largest portion would be that much like a hash, one small change will change the entire thing rather than a smaller portion (with the original blocksize). The multiple re-arranging and encryption steps is to ensure small

Re: New encryption block...

2016-10-09 Thread sarn via Digitalmars-d
On Sunday, 9 October 2016 at 20:33:29 UTC, Era Scarecrow wrote: Something coming to mind is the idea of making a small algorithm to be used with other already existing encryption functions to extend the blocksize of encryption with minimal complexity growth. In theory this would extend a

Re: What blogs about D do you read?

2016-09-20 Thread sarn via Digitalmars-d-learn
Don't forget the Planet D aggregator :) http://planet.dsource.org/ Here's my contribution: https://theartofmachinery.com/tags/dlang/

Re: Can vibe d leverage existing web technologies?

2016-09-16 Thread sarn via Digitalmars-d-learn
On Friday, 16 September 2016 at 12:46:34 UTC, Martin Tschierschke wrote: The "only" problem is you have to build your layout twice, in php and as diet template. :-( You also have to manage URLs across different codebases. I'd recommend against splitting up a frontend like that because it

Re: Critque of Rust's collection types

2016-09-15 Thread sarn via Digitalmars-d
On Thursday, 15 September 2016 at 10:13:47 UTC, cym13 wrote: DoS by collision attack are a form of preimage. The idea is to generate intentional collisions to force heavy computations on serveur side. It only works if finding collisions many collisions for the same hash is cheap which is

Re: vibe.d maxRequestSize

2016-09-15 Thread sarn via Digitalmars-d-learn
I hope this isn't too obvious, but I have to ask because it's such a common gotcha: Are you reverse proxying through a server like nginx by any chance? There are default request size limits there. (For nginx specifically, it's this one:

Re: pure functions

2016-09-12 Thread sarn via Digitalmars-d-learn
On Tuesday, 13 September 2016 at 03:33:04 UTC, Ivy Encarnacion wrote: Can pure functions throw exceptions on its arguments? You can throw exceptions for whatever reasons from a function marked pure: void foo() pure { throw new Exception("nope"); } void main() { foo(); }

Re: CompileTime performance measurement

2016-09-03 Thread sarn via Digitalmars-d
On Sunday, 4 September 2016 at 01:53:21 UTC, Stefan Koch wrote: Pragma msg can only print compiletime constants. While __ctfeWriteln can print state while doing CTFE. Thanks, that makes a lot of sense. Just to check, it prints to standard error, right? Also, the issue of non-deterministic

Re: CompileTime performance measurement

2016-09-03 Thread sarn via Digitalmars-d
On Sunday, 4 September 2016 at 00:04:16 UTC, Stefan Koch wrote: I recently implemented __ctfeWriteln. Sounds like pragma msg. How does it compare? https://dlang.org/spec/pragma.html#msg

Re: D for competitive programming

2016-07-29 Thread sarn via Digitalmars-d
To add to the list, here are a couple of other online judges that explicitly support D: http://www.spoj.com/ http://judge.u-aizu.ac.jp/onlinejudge/ Of course, if you use a language-agnostic platform like Code Jam, you can do what you like. Project Euler (maths-oriented) and the Matasano

Re: DConf Videos

2016-07-21 Thread sarn via Digitalmars-d
On Thursday, 21 July 2016 at 13:45:28 UTC, Steven Schveighoffer wrote: On 6/6/16 6:40 AM, sarn wrote: What's the best source of DConf videos at the moment? Are there are any edited versions released? I'd like to share some of my favourite talks. They are starting to arrive!

Re: Vision for the D language - stabilizing complexity?

2016-07-13 Thread sarn via Digitalmars-d
On Wednesday, 13 July 2016 at 10:02:58 UTC, Ola Fosheim Grøstad wrote: «Undefined» simply means that such code is not part of the specified language, as in, it is no longer the language covered. The optimizer is an implementation detail, the optimizer is not allowed to change the semantics of

Re: how to mark an extern function @nogc?

2016-07-12 Thread sarn via Digitalmars-d-learn
On Tuesday, 12 July 2016 at 14:04:55 UTC, Seb wrote: D is entirely driven by highly motivated volunteers. (this will change soon with the new D foundation) I for one welcome our new D Foundation overlords.

Re: Vision for the D language - stabilizing complexity?

2016-07-11 Thread sarn via Digitalmars-d
On Monday, 11 July 2016 at 22:09:11 UTC, Walter Bright wrote: On 7/10/2016 10:07 PM, Ola Fosheim Grøstad wrote: [Snip stuff about Scheme] Scheme is a really nice, elegant language that's fun to hack with, but at the end of the day, if people were writing Nginx, or the Windows kernel, or HFT

Re: Google's code ownership

2016-06-30 Thread sarn via Digitalmars-d
On Wednesday, 29 June 2016 at 22:35:03 UTC, qznc wrote: However, I'm not sure if "finding reviewers" is the bottleneck? Not everything applies because Google doesn't host its repo on Github (obviously), but code ownership works very well there. It helps avoid the bystander effect, and

Re: Button: A fast, correct, and elegantly simple build system.

2016-06-14 Thread sarn via Digitalmars-d-announce
On Monday, 13 June 2016 at 20:12:27 UTC, Walter Bright wrote: On 6/12/2016 4:27 PM, Jason White wrote: I don't understand this dependency-phobia. It's the "first 5 minutes" thing. Every hiccup there costs us maybe half the people who just want to try it out. ... The makefiles, especially

DConf Videos

2016-06-06 Thread sarn via Digitalmars-d
What's the best source of DConf videos at the moment? Are there are any edited versions released? I'd like to share some of my favourite talks.

Re: Preprocessing CSS

2016-05-24 Thread sarn via Digitalmars-d
On Tuesday, 24 May 2016 at 18:47:57 UTC, Andrei Alexandrescu wrote: On 05/24/2016 02:03 PM, Thiez wrote: Does the experience help someone getting a job in the industry? Probably not, again with the same caveat. I speculate experience with one of the other CSS scripting engines would also

Re: The Case Against Autodecode

2016-05-17 Thread sarn via Digitalmars-d
On Tuesday, 17 May 2016 at 09:53:17 UTC, Kagamin wrote: With UTF-8 problems happened on a massive scale in LAMP setups: mysql used latin1 as a default encoding and almost everything worked fine. ^ latin-1 with Swedish collation rules. And even if you set the encoding to "utf8", almost

Re: How are you enjoying DConf? And where to go next?

2016-05-06 Thread sarn via Digitalmars-d
On Friday, 6 May 2016 at 14:53:15 UTC, Jonathan M Davis wrote: Other places would certainly be interesting (e.g. Japan or Australia), and we definitely have devs in such places, but I don't know if we have enough likely attendees in such areas to make them make sense, since picking somewhere

Re: D Conference - use twitter #dconf to keep up to date

2016-05-03 Thread sarn via Digitalmars-d-announce
On Tuesday, 3 May 2016 at 03:10:57 UTC, Walter Bright wrote: Jet lagged as I am, I'll be at breakfast at Hotel Ibis at 630am. Come and join me! Damn, I got there at 7:30. Anyone else still around? (I don't use Twitter.)

Re: Weak Purity Blog Post

2016-03-30 Thread sarn via Digitalmars-d-announce
Yeah, there's a lot more stuff I could have talked about, but I think I'll leave it for other posts. About testing, I think the way protection works in D (i.e., private members are accessible within the same file) is important, too. I was a bit suspicious of that feature when I first looked

Re: Weak Purity Blog Post

2016-03-30 Thread sarn via Digitalmars-d-announce
On Monday, 28 March 2016 at 09:59:12 UTC, ag0aep6g wrote: On 28.03.2016 03:44, sarn wrote: https://theartofmachinery.com/2016/03/28/dirtying_pure_functions_can_be_useful.html From there: Well, you can get the usual (“strong”) purity guarantee just by making all pointer or reference type

Re: Tristate - wanna?

2016-03-27 Thread sarn via Digitalmars-d
On Saturday, 26 March 2016 at 22:39:58 UTC, Alex Parrill wrote: On Saturday, 26 March 2016 at 22:11:53 UTC, Nordlöw wrote: I can think of many variants of for this. What about { yes, // 1 chance no, // 0 chance likely, // > 1/2 chance unlikely, // < 1/2 chance

Weak Purity Blog Post

2016-03-27 Thread sarn via Digitalmars-d-announce
D's implementation of functional purity supports "weak" purity - functions that can mutate arguments but are otherwise traditionally pure. I wrote a post about some of the practical benefits of this kind of purity:

Re: Functions that return type

2016-01-16 Thread sarn via Digitalmars-d-learn
On Saturday, 16 January 2016 at 21:22:15 UTC, data pulverizer wrote: Is it possible to create a function that returns Type like typeof() does? Something such as: Type returnInt(){ return int; } A type itself isn't a runtime value. I think the closest thing is a TypeInfo object:

Re: Password Storage

2016-01-03 Thread sarn via Digitalmars-d-learn
On Friday, 27 November 2015 at 00:17:34 UTC, brian wrote: 3) pre- or post-pend the salt to the password entered (apparently there is a difference??) Sorry to revive an old thread, but I wrote a blog post about this question:

<    1   2