Vibe.d diet template reuse

2016-11-02 Thread Jot via Digitalmars-d-learn
I would like to create some generic diet templates for different html functionality. Some code in the template will need to be setup/changed for it to function properly. How can I write code that allows for one to express generic statements in the template but access/modify them in another

fPIC Error

2016-11-02 Thread Dlang User via Digitalmars-d-learn
I am running Debian Testing and I think I have run into the recent fPIC issue. This is the source code for the test project I am using: import std.stdio; void main() { writeln("Edit source/app.d to start your project."); readln(); } When I try to compile a project, I get

mangle!(void function())("foo").demangle = "void function()* foo"

2016-11-02 Thread Timothee Cour via Digitalmars-d-learn
mangle!(void function())("foo").demangle returns "void function()* foo" how would i get instead: `void foo ()` ? my current workaround: alias FunctionTypeOf(Fun)=typeof(*Fun.init); mangle!(FunctionTypeOf!(void function()))("foo")

Re: Error: function std.stdio.setmode is not accessible from module a

2016-11-02 Thread Kirill Kryukov via Digitalmars-d-learn
On Wednesday, 2 November 2016 at 11:17:49 UTC, Jonathan M Davis wrote: setmode was never publicly documented, and technically, you weren't supposed to be using it from there (since it wasn't documented). It was fixed in 2.072.0 so that all of the undocumented stuff in std.stdio was made

Re: Should I prefer immutable or const?

2016-11-02 Thread Jonathan M Davis via Digitalmars-d-learn
On Wednesday, November 02, 2016 23:23:22 Nordlöw via Digitalmars-d-learn wrote: > On Tuesday, 1 November 2016 at 18:55:26 UTC, Jonathan M Davis > > wrote: > > - Jonathan M Davis > > Thanks. I'll go for immutable, when possible, then. > > I wish I had a shorter way to write immutable, though :) >

Re: Should I prefer immutable or const?

2016-11-02 Thread Nordlöw via Digitalmars-d-learn
On Tuesday, 1 November 2016 at 18:55:26 UTC, Jonathan M Davis wrote: - Jonathan M Davis Thanks. I'll go for immutable, when possible, then. I wish I had a shorter way to write immutable, though :) Do you think it would be possible to adopt Rust's syntax `let`?

Re: Best way to get ceil(log2(x)) of a BigInt?

2016-11-02 Thread Andrea Fontana via Digitalmars-d-learn
On Wednesday, 2 November 2016 at 15:15:18 UTC, Andrea Fontana wrote: Why don't you perform a binary search over 200 power of 2? Something like: http://paste.ofcode.org/scMD5JbmLMZkrv3bWRmPPT I wonder if a simple binary search on whole array is faster than search for limits as in this example

Re: Best way to get ceil(log2(x)) of a BigInt?

2016-11-02 Thread Andrea Fontana via Digitalmars-d-learn
On Wednesday, 2 November 2016 at 14:49:08 UTC, pineapple wrote: On Wednesday, 2 November 2016 at 14:24:42 UTC, Andrea Fontana wrote: On Wednesday, 2 November 2016 at 14:05:50 UTC, pineapple wrote: I'm trying to do some math stuff with std.bigint and realized there's no obvious way to calculate

Re: Set Operations on Set-like Containers

2016-11-02 Thread Andrei Alexandrescu via Digitalmars-d-learn
On 11/02/2016 11:07 AM, Nordlöw wrote: On Wednesday, 2 November 2016 at 13:45:41 UTC, Nordlöw wrote: Typically set- and map-like containers with O(1) key membership checking. A typical use case is intersection of the two sets `x` and `y`. When `x` and `y` both support O(1)-`contains(e)` the

Re: Set Operations on Set-like Containers

2016-11-02 Thread Nordlöw via Digitalmars-d-learn
On Wednesday, 2 November 2016 at 13:45:41 UTC, Nordlöw wrote: Typically set- and map-like containers with O(1) key membership checking. A typical use case is intersection of the two sets `x` and `y`. When `x` and `y` both support O(1)-`contains(e)` the preferred algorithm is to interate over

Re: Best way to get ceil(log2(x)) of a BigInt?

2016-11-02 Thread pineapple via Digitalmars-d-learn
On Wednesday, 2 November 2016 at 14:24:42 UTC, Andrea Fontana wrote: On Wednesday, 2 November 2016 at 14:05:50 UTC, pineapple wrote: I'm trying to do some math stuff with std.bigint and realized there's no obvious way to calculate the ceil of log2 of a bigint. Help? How big are your bigints?

Re: Best way to get ceil(log2(x)) of a BigInt?

2016-11-02 Thread Andrea Fontana via Digitalmars-d-learn
On Wednesday, 2 November 2016 at 14:05:50 UTC, pineapple wrote: I'm trying to do some math stuff with std.bigint and realized there's no obvious way to calculate the ceil of log2 of a bigint. Help? How big are your bigints?

Best way to get ceil(log2(x)) of a BigInt?

2016-11-02 Thread pineapple via Digitalmars-d-learn
I'm trying to do some math stuff with std.bigint and realized there's no obvious way to calculate the ceil of log2 of a bigint. Help?

Set Operations on Set-like Containers

2016-11-02 Thread Nordlöw via Digitalmars-d-learn
Does https://dlang.org/phobos/std_algorithm_setops.html support specializations when (some) arguments are containers/ranges that provide the `in` operator? Typically set- and map-like containers with O(1) key membership checking. If not, should they? And what about operator overloading

Re: Error: function std.stdio.setmode is not accessible from module a

2016-11-02 Thread Jonathan M Davis via Digitalmars-d-learn
On Wednesday, November 02, 2016 08:58:04 Kirill Kryukov via Digitalmars-d- learn wrote: > Hello, > > dmd 2.072.0 broke my project. I reduced it to following: > > = a.d start = > import std.stdio; > > void main() > { > setmode(stdin.fileno, 0x8000); > } > = a.d end = > >

Error: function std.stdio.setmode is not accessible from module a

2016-11-02 Thread Kirill Kryukov via Digitalmars-d-learn
Hello, dmd 2.072.0 broke my project. I reduced it to following: = a.d start = import std.stdio; void main() { setmode(stdin.fileno, 0x8000); } = a.d end = Compiling on Windows 7 64-bit with the following commands: C:\utl\dev\D\dmd-2.071.2\windows\bin\dmd.exe a.d -ofa1.exe

Re: is there "this"?

2016-11-02 Thread Jonathan M Davis via Digitalmars-d-learn
On Wednesday, November 02, 2016 02:42:01 Konstantin Kutsevalov via Digitalmars-d-learn wrote: > I tested already and it really works, thank you. > I asked that because I tried once to use "this" in past but I got > error. So I asked on some forum "how to get property of class?" > and peoples said

Re: is there "this"?

2016-11-02 Thread Jonathan M Davis via Digitalmars-d-learn
On Wednesday, November 02, 2016 07:26:57 Bauss via Digitalmars-d-learn wrote: > Well "this" in D has different meanings as it depends on its > context sometimes. Yes, but it's almost always the same thing that you'd expect from a language like C++ or Java. - Jonathan M Davis

Re: is there "this"?

2016-11-02 Thread Bauss via Digitalmars-d-learn
On Wednesday, 2 November 2016 at 02:42:01 UTC, Konstantin Kutsevalov wrote: On Wednesday, 2 November 2016 at 02:33:10 UTC, Konstantin Kutsevalov wrote: On Wednesday, 2 November 2016 at 02:20:43 UTC, rikki cattermole wrote: On 02/11/2016 3:17 PM, Konstantin Kutsevalov wrote: [...] You forgot

Re: Assistance with DUB

2016-11-02 Thread Basile B. via Digitalmars-d-learn
On Tuesday, 1 November 2016 at 22:01:23 UTC, Alfred Newman wrote: Greetings, I need some help with dub libraries. Executing "dub list" in my machine, I got the following: Packages present in the system and known to dub: colorize ~master: