vibe.d and video files?

2020-09-17 Thread bauss via Digitalmars-d-learn
Does vibe.d not work properly with ex. mp4 files? I have a consistent issues that it will only play part of video files in the browser. As if it won't "stream" the rest of the video. Is that a problem with vibe.d or is it some configuration that needs to be enabled?

Re: vibe.d and my first web service

2020-07-19 Thread bauss via Digitalmars-d-learn
On Saturday, 18 July 2020 at 17:23:06 UTC, Mr. Backup wrote: On Saturday, 18 July 2020 at 12:16:09 UTC, Andre Pany wrote: On Saturday, 18 July 2020 at 09:10:04 UTC, Mr. Backup wrote: [...] I assume you are using vibe.d 0.8.4 or older. Please check whether adding this to dub.json solves your

Re: Vibe.d and NodeJs with Express

2020-07-14 Thread bauss via Digitalmars-d-learn
On Sunday, 12 July 2020 at 19:16:32 UTC, aberba wrote: 3) packages, now it might be better though. But I've always felt that there's not a lot of people using D for complete web dev projects... I'm one of the few but then again I don't use a lot of external packages either other than what

Re: constructing labels for static foreach inside switch inside foreach

2020-07-07 Thread bauss via Digitalmars-d-learn
On Wednesday, 8 July 2020 at 02:06:01 UTC, Steven Schveighoffer wrote: OK, so I have a situation where I'm foreaching over a compile-time list of types. Inside the loop, I'm using a second loop over a set of input. Inside that loop, I'm using a switch on the input, and inside the switch, I'm

Re: I want Sublime 3 D auto import !

2020-06-03 Thread bauss via Digitalmars-d-learn
On Wednesday, 3 June 2020 at 11:54:57 UTC, Виталий Фадеев wrote: On Tuesday, 2 June 2020 at 20:08:09 UTC, bauss wrote: What happens if you have the same symbol in multiple modules? Ex. two libraries that implement symbols with same name. First module will inserted. Is there a way to be

Re: I want Sublime 3 D auto import !

2020-06-02 Thread bauss via Digitalmars-d-learn
On Tuesday, 2 June 2020 at 06:00:10 UTC, Виталий Фадеев wrote: On Monday, 1 June 2020 at 18:55:03 UTC, Paul Backus wrote: On Monday, 1 June 2020 at 16:18:44 UTC, Виталий Фадеев wrote: I do it! https://github.com/vitalfadeev/SublimeDlangAutoImport What happens if you have the same symbol in

Re: How to get the pointer of "this" ?

2020-05-26 Thread bauss via Digitalmars-d-learn
On Tuesday, 26 May 2020 at 12:08:29 UTC, Johannes Loher wrote: On Tuesday, 26 May 2020 at 11:44:58 UTC, Vinod K Chandran wrote: On Monday, 25 May 2020 at 16:39:30 UTC, Mike Parker wrote: On Monday, 25 May 2020 at 08:39:23 UTC, John Burton wrote: I believe that in D *this* is a reference to

Re: How to get the pointer of "this" ?

2020-05-25 Thread bauss via Digitalmars-d-learn
On Monday, 25 May 2020 at 17:14:13 UTC, Vinod K Chandran wrote: On Monday, 25 May 2020 at 16:54:11 UTC, Mike Parker wrote: On Monday, 25 May 2020 at 16:26:31 UTC, Vinod K Chandran wrote: [...] The error has nothing to do with taking a pointer to `this`. It's suggesting that somewhere in

Re: How to get the pointer of "this" ?

2020-05-24 Thread bauss via Digitalmars-d-learn
On Sunday, 24 May 2020 at 17:05:16 UTC, Vinod K Chandran wrote: Hi all, I have a class like this. class Button : Control { ... HWND createButton(){ ... SetWindowSubclass(this.mHandle, SUBCLASSPROC(), UINT_PTR(subClsID), cast(DWORD_PTR) this); } } But

Re: Variable "i" can not be read at compile time

2020-05-24 Thread bauss via Digitalmars-d-learn
On Sunday, 24 May 2020 at 17:13:23 UTC, data pulverizer wrote: On Sunday, 24 May 2020 at 16:57:54 UTC, ag0aep6g wrote: On 24.05.20 18:34, data pulverizer wrote: Since `kernel` is a `Tuple`, you can only access it with compile-time constant indices. But your loop variable `i` is not a

Re: Using Vibe.d for not HTTP

2020-05-24 Thread bauss via Digitalmars-d-learn
On Sunday, 24 May 2020 at 08:10:33 UTC, Russel Winder wrote: Hi, Clearly Vibe.d is mostly for people doing HTTP and HTTPS stuff. Yet it claims to be able to support TCP and UDP working with other protocols. However, all the serious examples are HTTP/HTTPS related. All the TCP and UDP

Re: Distinguish between a null array and an empty array

2020-05-24 Thread bauss via Digitalmars-d-learn
On Sunday, 24 May 2020 at 12:26:42 UTC, ag0aep6g wrote: On 24.05.20 14:12, bauss wrote: Is there a way to do that? Since the following are both true: int[] a = null; int[] b = []; assert(a is null); assert(!a.length); assert(b is null); assert(!b.length); What I would like is to tell that

Re: Distinguish between a null array and an empty array

2020-05-24 Thread bauss via Digitalmars-d-learn
On Sunday, 24 May 2020 at 12:12:31 UTC, bauss wrote: Is there a way to do that? Since the following are both true: int[] a = null; int[] b = []; assert(a is null); assert(!a.length); assert(b is null); assert(!b.length); What I would like is to tell that b is an empty array and a is a null

Distinguish between a null array and an empty array

2020-05-24 Thread bauss via Digitalmars-d-learn
Is there a way to do that? Since the following are both true: int[] a = null; int[] b = []; assert(a is null); assert(!a.length); assert(b is null); assert(!b.length); What I would like is to tell that b is an empty array and a is a null array.

Re: Learning Vibe.d

2020-05-23 Thread bauss via Digitalmars-d-learn
On Saturday, 23 May 2020 at 17:57:22 UTC, Russel Winder wrote: On Sat, 2020-05-23 at 16:56 +, bauss via Digitalmars-d-learn wrote: […] Had similar experiences on non-windows platforms. I forgot to mention I was on Linux (Debian Sid). I am (sort of) pleased it isn't just me – definitely

Re: Learning Vibe.d

2020-05-23 Thread bauss via Digitalmars-d-learn
On Saturday, 23 May 2020 at 15:47:59 UTC, Russel Winder wrote: Hi, I thought I would try and do the async version of my mock AVR850 using the vibe.d TCP stuff. This is not HTTP, it is proper networking! ;-) Problem one is that vibe.d sever processes never seem to terminate. I am using

std.container.array pointer

2020-05-23 Thread bauss via Digitalmars-d-learn
Is it possible to have a pointer to a nogc array? Like for regular arrays you can just do .ptr How would you do the same for a nogc array? The reason is I need to read different types of values from a nogc byte array. Ex. reading an int at offset 12 of the array. With normal arrays it can

to but nothrow?

2020-05-22 Thread bauss via Digitalmars-d-learn
Is there anyway to use the "to" template from std.conv but as nothrow? Having it throw exceptions is not always acceptable because it's generally expensive. Something that attempted to convert would be far more fesible. Is there anything like that? Ex. from C# there's int.TryParse etc.

Re: D and Async I/O

2020-05-11 Thread bauss via Digitalmars-d-learn
On Monday, 11 May 2020 at 14:02:54 UTC, Russel Winder wrote: OK, so I need to create an asynchronous TCP server (not HTTP or HTTPS, this is a real server ;-) ). I think the normal response is "Use Vibe.d". However, recently I see Hunt is an alternative. Has anyone any way of choosing between

Re: Why does indexing a string inside of a recursive call yield a different result?

2020-05-10 Thread bauss via Digitalmars-d-learn
On Sunday, 10 May 2020 at 10:02:18 UTC, Adnan wrote: In my naive implementation of edit-distance finder, I have to check whether the last characters of two strings match: ulong editDistance(const string a, const string b) { if (a.length == 0) return b.length; if (b.length ==

Re: Is is a Bug or just me?

2020-05-09 Thread bauss via Digitalmars-d-learn
On Friday, 8 May 2020 at 14:16:10 UTC, foerdi wrote: Hi d community, I got a strange behavior since dmd 2.090 (dmd 2.089 is the last working version). See this reduced code: https://run.dlang.io/is/yoyHXC I would expect that foo() returns 2. My guess in foo is: The return value of val is

Re: Get months / years between two dates.

2020-05-09 Thread bauss via Digitalmars-d-learn
On Thursday, 7 May 2020 at 11:40:36 UTC, WebFreak001 wrote: On Wednesday, 6 May 2020 at 19:51:01 UTC, bauss wrote: How do you exactly do that? Like if I have two dates as std.datetime.DateTime How will I get the months or years between the two dates? I was surprised to learn that Duration

Re: Get months / years between two dates.

2020-05-06 Thread bauss via Digitalmars-d-learn
On Wednesday, 6 May 2020 at 19:58:59 UTC, Adam D. Ruppe wrote: On Wednesday, 6 May 2020 at 19:51:01 UTC, bauss wrote: How will I get the months or years between the two dates? What's the length of a month or a year? That's the tricky part - they have variable lengths. So a difference of one

Get months / years between two dates.

2020-05-06 Thread bauss via Digitalmars-d-learn
How do you exactly do that? Like if I have two dates as std.datetime.DateTime How will I get the months or years between the two dates? I was surprised to learn that Duration does not support them and only has weeks, days etc. but not months or years. I can't seem to find any standard way

Re: .get refuses to work on associative array

2020-04-15 Thread bauss via Digitalmars-d-learn
On Wednesday, 15 April 2020 at 22:09:32 UTC, H. S. Teoh wrote: On Wed, Apr 15, 2020 at 09:46:58PM +, p.shkadzko via Digitalmars-d-learn wrote: I am quite confused by the following exception during dub build: > dub build --single demo.d --compiler=ldc2 --force Performing "debug" build

Re: Swedish letters fuck up parsing into SQL querry

2020-03-23 Thread bauss via Digitalmars-d-learn
On Monday, 23 March 2020 at 14:26:46 UTC, Anders S wrote: On Monday, 23 March 2020 at 13:53:50 UTC, Adam D. Ruppe wrote: My first thought is to!string(cellTab[CellIndex].name) is wrong, if it is a char[20] you should be scanning it to find the length and slicing. Maybe [0 ..

Re: Best way to learn 2d games with D?

2020-03-17 Thread bauss via Digitalmars-d-learn
On Tuesday, 17 March 2020 at 23:09:32 UTC, Dennis wrote: On Tuesday, 17 March 2020 at 22:47:43 UTC, Sebastiaan Koppe wrote: Dont trust that marketing, there is actually decent scripting in gamemaker, which you'll need if you get creative. Second that. GameMaker is how I got into programming

Re: Best way to learn 2d games with D?

2020-03-15 Thread bauss via Digitalmars-d-learn
On Monday, 16 March 2020 at 02:52:56 UTC, Mike Parker wrote: On Sunday, 15 March 2020 at 18:14:44 UTC, bauss wrote: I would recommend using Derelict and SDL with D since it's the most mature. Please don't recommend Derelict to anyone :-) bindbc-sdl is what folks should be using now. I'm

Re: Best way to learn 2d games with D?

2020-03-15 Thread bauss via Digitalmars-d-learn
On Sunday, 15 March 2020 at 17:58:58 UTC, Steven Schveighoffer wrote: I want to try and learn how to write 2d games. I'd prefer to do it with D. I've found a ton of tutorials on learning 2d gaming with other languages. Is there a place to look that uses D for learning? Should I just start

Re: D create many thread

2020-02-06 Thread bauss via Digitalmars-d-learn
On Thursday, 6 February 2020 at 22:00:26 UTC, tchaloupka wrote: On Wednesday, 5 February 2020 at 13:05:59 UTC, Eko Wahyudin wrote: Hi all, I'm create a small (hallo world) application, with DMD. But my program create 7 annoying threads when create an empty class. If you don't want the

Re: How do I fix my failed PRs?

2020-02-02 Thread bauss via Digitalmars-d-learn
On Sunday, 2 February 2020 at 12:49:31 UTC, MoonlightSentinel wrote: On Sunday, 2 February 2020 at 08:54:02 UTC, mark wrote: However, four have not been accepted, apparently for technical reasons. But I don't understand what's wrong or what I need to do to fix them. (I'm not very knowledgeable

Re: How do I fix my failed PRs?

2020-02-02 Thread bauss via Digitalmars-d-learn
On Sunday, 2 February 2020 at 08:54:02 UTC, mark wrote: I've done quite a few small corrections/improvements to the D-tour's English. Almost all have been accepted. However, four have not been accepted, apparently for technical reasons. But I don't understand what's wrong or what I need to

Re: Constant GC allocations when sending large messages to threads?

2020-01-31 Thread bauss via Digitalmars-d-learn
On Friday, 31 January 2020 at 07:14:30 UTC, cc wrote: On Wednesday, 29 January 2020 at 21:10:53 UTC, Steven Schveighoffer wrote: I'm pretty sure std.concurrency uses Variant to pass message data, which boxes when it gets over a certain size. You are probably crossing that threshold. The

Re: format with floating points GC allocating in DMD 2.090

2020-01-31 Thread bauss via Digitalmars-d-learn
On Friday, 31 January 2020 at 07:20:17 UTC, cc wrote: char[4096] buf; writeln(GC.stats.usedSize); foreach (i; 0 .. 10) { sformat(buf, "%f", 1.234f); writeln(GC.stats.usedSize); } Output with DMD32 D Compiler v2.089.1-dirty (Win10

Re: How change window Backgound Color when press a Button when using "ResEdit Resource Editor" to design?

2020-01-29 Thread bauss via Digitalmars-d-learn
On Thursday, 30 January 2020 at 03:49:29 UTC, Marcone wrote: I created a GUI using "ResEdit Resource Editor" and embeded to Dlang using this code above. Now I want to change the window Backgound Color when press a Button. How can I make it? You need to handle WM_ERASEBKGND And then you

Re: Blog Post #0096: Hardware III - Keyboard and Mouse

2019-12-31 Thread bauss via Digitalmars-d-learn
On Tuesday, 31 December 2019 at 09:27:44 UTC, Ron Tarrant wrote: This week's post wraps up the year by looking at how to access keyboard and mouse events through the hardware Seat. You'll find it here: https://gtkdcoding.com/2019/12/31/0096-hardware-iii-keyboard-pointer.html Have a happy New

Re: D vs Java which is more powerful

2019-11-16 Thread bauss via Digitalmars-d-learn
On Saturday, 16 November 2019 at 07:24:50 UTC, GreatSam4sure wrote: According to this [1] a person that java is much more powerful than D. I am really surprised at this claim. Is this true? Because I believe D much more powerful than Java. I will really appreciate detail analysis

Re: Is there any writeln like functions without GC?

2019-11-11 Thread bauss via Digitalmars-d-learn
On Saturday, 9 November 2019 at 22:03:03 UTC, Ferhat Kurtulmuş wrote: On Thursday, 31 October 2019 at 03:56:56 UTC, lili wrote: Hi: why writeln need GC? Upon this post, I thought writing a gc-free writeln would be a good learning practice. Although it is not a feature-complete one, it

Re: Blog Post #0062: Cairo Load & Display Images

2019-08-17 Thread bauss via Digitalmars-d-learn
On Saturday, 17 August 2019 at 19:22:54 UTC, Ron Tarrant wrote: On Friday, 16 August 2019 at 12:44:15 UTC, bauss wrote: Amazing! You might be able to answer me something, whether you could use gtkd solely for image manipulation using ex. Pixbuf? or would it only work with the internals of

Re: Blog Post #0062: Cairo Load & Display Images

2019-08-16 Thread bauss via Digitalmars-d-learn
On Friday, 16 August 2019 at 11:42:01 UTC, Ron Tarrant wrote: Continuing on with Cairo, this post covers loading and displaying three types of image (including a structured drawing) using two different load-n-display methods. As an extra bonus, you'll see a photo of my cat, Bob, and three of

Re: Cannot take the .keys of shared AA. Is this a regression in 2.087 or a feature?

2019-08-15 Thread bauss via Digitalmars-d-learn
On Thursday, 15 August 2019 at 19:51:30 UTC, Jonathan M Davis wrote: n Thursday, August 15, 2019 11:33:06 AM MDT Piotr Mitana via Digitalmars-d- learn wrote: Code: import std; shared(string[string]) dict; void main() { dict.keys; } Error:

Re: Speed of Random Numbers

2019-08-03 Thread bauss via Digitalmars-d-learn
On Saturday, 3 August 2019 at 17:47:46 UTC, Giovanni Di Maria wrote: On Saturday, 3 August 2019 at 17:44:44 UTC, lithium iodate wrote: On Saturday, 3 August 2019 at 16:35:34 UTC, Giovanni Di Maria wrote: [...] First off you could try to use a faster RNG engine than the default. The easiest

Re: Is there a way to adjust lookup paths for modules during compilation?

2019-07-31 Thread bauss via Digitalmars-d-learn
On Wednesday, 31 July 2019 at 17:29:58 UTC, Andrey Zherikov wrote: I want my program to add some directories into module lookup process (like adding -I dmd options). List of directories is known at compile time but the choice of what exact directories to add depends on `-version` parameter.

Re: vibe / self contained standalone executable?

2019-07-28 Thread bauss via Digitalmars-d-learn
On Sunday, 28 July 2019 at 18:54:37 UTC, Sebastiaan Koppe wrote: On Sunday, 28 July 2019 at 14:42:48 UTC, Robert M. Münch wrote: On 2019-07-28 14:14:06 +, Sebastiaan Koppe said: I am using https://dlang.org/spec/expression.html#import_expressions for text files. Don't know if it works on

Re: vibe / self contained standalone executable?

2019-07-28 Thread bauss via Digitalmars-d-learn
On Sunday, 28 July 2019 at 14:14:06 UTC, Sebastiaan Koppe wrote: On Sunday, 28 July 2019 at 13:45:50 UTC, Robert M. Münch wrote: Is it possible to pack a complete "web-app" (serving web-pages and providing REST API) into a single executable so that no other files need to be accessed and

Re: Is betterC affect to compile time?

2019-07-25 Thread bauss via Digitalmars-d-learn
On Thursday, 25 July 2019 at 18:06:02 UTC, Jonathan Marler wrote: On Thursday, 25 July 2019 at 12:46:48 UTC, Oleg B wrote: On Thursday, 25 July 2019 at 12:34:15 UTC, rikki cattermole wrote: Those restrictions don't stop at runtime. It's vary sad. What reason for such restrictions? It's

Re: Mixin mangled name

2019-07-02 Thread bauss via Digitalmars-d-learn
On Monday, 1 July 2019 at 23:52:49 UTC, Andrey wrote: Hello, Is it possible to mixin in code a mangled name of some entity so that compiler didn't emit undefined symbol error? For example mangled function name or template parameter? Perhaps: https://dlang.org/spec/pragma.html#mangle

Re: dll

2019-06-27 Thread bauss via Digitalmars-d-learn
On Thursday, 27 June 2019 at 16:56:00 UTC, fred wrote: https://forum.dlang.org/thread/osnema$d5s$1...@digitalmars.com dll support is it ok now? i cant find the docs on thatm Not much better.

Re: Create empty SList or DList.

2019-06-26 Thread bauss via Digitalmars-d-learn
On Wednesday, 26 June 2019 at 19:06:24 UTC, drug wrote: 26.06.2019 20:39, bauss пишет: auto stack = SList!int(0); stack.removeFront(); Then something that just allowed you to do: auto stack = SList!int; this compiles: ``` auto stack = SList!int(); ``` Maybe something else triggered it for

Create empty SList or DList.

2019-06-26 Thread bauss via Digitalmars-d-learn
Is there a way to achieve that instead of something hacky like adding an initialized element and then removing it. Ex. instead of: auto stack = SList!int(0); stack.removeFront(); Then something that just allowed you to do: auto stack = SList!int; // Not allowed. --- I feel like this makes

Re: bug in compiles?

2019-04-11 Thread bauss via Digitalmars-d-learn
On Thursday, 11 April 2019 at 18:13:48 UTC, Alex wrote: The following code works when I comment out the static if //static if (__traits(compiles, __traits(getAttributes, T))) static foreach(a; __traits(getAttributes, T)) Attributes ~= There seems to be absolutely no reason why this code

Re: Iterate/sort associative array by value?

2019-04-07 Thread bauss via Digitalmars-d-learn
On Sunday, 7 April 2019 at 16:44:01 UTC, Robert M. Münch wrote: On 2019-04-07 16:24:52 +, Cym13 said: You could use sort to gather the indexes in order then traverse from there: aa.byKey.array.sort!((a, b) => aa[a] That doesn't work: Error: no property array for type Result With

Re: What's the correct way to interface with a intptr_t?

2019-04-07 Thread bauss via Digitalmars-d-learn
On Sunday, 7 April 2019 at 13:45:15 UTC, Paul Backus wrote: On Sunday, 7 April 2019 at 12:19:10 UTC, bauss wrote: On Saturday, 6 April 2019 at 20:16:06 UTC, Paul Backus wrote: On Saturday, 6 April 2019 at 19:31:15 UTC, Robert M. Münch wrote: I have a C interface that uses a parameter of type

Re: == comparison of string literals, and their usage

2019-04-07 Thread bauss via Digitalmars-d-learn
On Saturday, 6 April 2019 at 19:47:14 UTC, lithium iodate wrote: On Saturday, 6 April 2019 at 15:35:22 UTC, diniz wrote: So, I still could store and use and compare string pointers myself [1], and get valid results, meaning: pointer equality implies (literal) string equality. Or am I wrong?

Re: What's the correct way to interface with a intptr_t?

2019-04-07 Thread bauss via Digitalmars-d-learn
On Saturday, 6 April 2019 at 20:16:06 UTC, Paul Backus wrote: On Saturday, 6 April 2019 at 19:31:15 UTC, Robert M. Münch wrote: I have a C interface that uses a parameter of type intptr_t. Wondering if size_t is the correct D equivalent? The correct equivalent is `intptr_t` from

Re: why is ifThrown un@safe?

2019-03-15 Thread bauss via Digitalmars-d-learn
On Friday, 15 March 2019 at 18:04:05 UTC, Bastiaan Veelo wrote: In the code below (https://run.dlang.io/is/d0oTNi), ifThrown is inferred as un@safe. If instead I write the implementation of ifThrown out (after res2) then it is @safe. As far as I can see, there is no real difference. So why

Re: Simplifying a string mixin

2019-02-26 Thread bauss via Digitalmars-d-learn
On Monday, 25 February 2019 at 21:04:48 UTC, Adam D. Ruppe wrote: On Monday, 25 February 2019 at 20:57:37 UTC, Victor Porton wrote: Can string mixing be split into several parts? I have a mixin like this: mixin("struct " ~ name ~ " {\n" ~ " struct Regular {\n" ~ "

Re: variant .init value

2019-02-07 Thread bauss via Digitalmars-d-learn
On Thursday, 7 February 2019 at 07:33:50 UTC, Norm wrote: Hi, I'm trying to use Variant in a struct and want a default init value like so: --- struct S { Variant v = Variant(10); } void main() {auto s = S();} but when I try to build this I get the following error:

Re: Singleton in Action?

2019-02-04 Thread bauss via Digitalmars-d-learn
On Saturday, 2 February 2019 at 16:56:45 UTC, Ron Tarrant wrote: Hi guys, I ran into another snag this morning while trying to implement a singleton. I found all kinds of examples of singleton definitions, but nothing about how to put them into practice. Can someone show me a code example

Re: crashing with no stack trace, why?

2019-01-31 Thread bauss via Digitalmars-d-learn
On Thursday, 31 January 2019 at 11:09:56 UTC, DanielG wrote: I have a program that was crashing due to a "Conversion positive overflow", specifically calling .to!int on a too-large unsigned value. However it was simply crashing with an exit code (-1073740771 / ‭0xC41D‬), and I was having

Re: Vibed + OpenSSL on Windows 10?

2019-01-29 Thread bauss via Digitalmars-d-learn
On Tuesday, 29 January 2019 at 10:12:30 UTC, Suliman wrote: On Tuesday, 29 January 2019 at 10:06:43 UTC, Suliman wrote: On Tuesday, 29 January 2019 at 10:01:04 UTC, Suliman wrote: Always compile vibe.d with mscoff Could you show command to compile with mscoff? I am not sure that all works

Re: Vibed + OpenSSL on Windows 10?

2019-01-29 Thread bauss via Digitalmars-d-learn
On Tuesday, 29 January 2019 at 06:48:38 UTC, Suliman wrote: Does anybody have success with using vibed 0.8.4 with OpenSSL 1.0/1.1 on Windows? I tried all possible solutions without any result. I am getting linking error: Copyright (C) Digital Mars 1989-2013 All rights reserved.

Re: Implement Interface Using Super

2019-01-27 Thread bauss via Digitalmars-d-learn
On Sunday, 27 January 2019 at 09:31:46 UTC, bauss wrote: On Sunday, 27 January 2019 at 05:37:57 UTC, Jonathan Levi wrote: This works in LDC but not DMD? ``` class A : B, I { alias i = typeof(super).i; } class B { void i() { writeln("i"); } } interface I { void i(); }

Re: Implement Interface Using Super

2019-01-27 Thread bauss via Digitalmars-d-learn
On Sunday, 27 January 2019 at 05:37:57 UTC, Jonathan Levi wrote: This works in LDC but not DMD? ``` class A : B, I { alias i = typeof(super).i; } class B { void i() { writeln("i"); } } interface I { void i(); } ``` Is this a bug in DMD or in LDC? How can I get this

Re: Am I missing with ref in this code?

2019-01-24 Thread bauss via Digitalmars-d-learn
On Thursday, 24 January 2019 at 21:25:45 UTC, Paul Backus wrote: So, I'm not sure what the best solution here is. The best solution is just to pass a copy since there's no absolute need for a reference to be passed.

Re: How to ensure string compatibility In D?

2019-01-22 Thread bauss via Digitalmars-d-learn
On Tuesday, 22 January 2019 at 19:14:43 UTC, Jonathan M Davis wrote: On Tuesday, January 22, 2019 12:05:32 PM MST Stefan Koch via Digitalmars-d- learn wrote: On Tuesday, 22 January 2019 at 16:47:45 UTC, FrankLike wrote: > On Tuesday, 22 January 2019 at 16:18:17 UTC, Adam D. Ruppe > > wrote: >>

Re: Why D isn't the next "big thing" already

2019-01-21 Thread bauss via Digitalmars-d-learn
On Monday, 21 January 2019 at 11:41:36 UTC, Simen Kjærås wrote: On Monday, 21 January 2019 at 11:37:52 UTC, sneha wrote: [snip] I agree with you. Holy thread necromancy, batman! -- Simen He's probably using IE so he just got the latest forum updates there.

Re: Read a text file in any position.

2019-01-18 Thread bauss via Digitalmars-d-learn
On Friday, 18 January 2019 at 08:10:25 UTC, Giovanni Di Maria wrote: Hi All I have a text file like this: 11 22 33 44 55 66 77 .. I execute these functions: i = archive.readln(); i = archive.readln(); i = archive.readln(); i = archive.readln(); so "i" is

Re: uniq and array of enum members (That are all strings)

2019-01-16 Thread bauss via Digitalmars-d-learn
On Wednesday, 16 January 2019 at 18:20:57 UTC, H. S. Teoh wrote: T I'm aware of how to do it manually as I already stated I went with a similar approach. There should just be something standard for it and uniq should have an overload or something that allows for another behavior that

Re: uniq and array of enum members (That are all strings)

2019-01-16 Thread bauss via Digitalmars-d-learn
On Wednesday, 16 January 2019 at 17:28:14 UTC, Alex wrote: On Wednesday, 16 January 2019 at 16:52:50 UTC, bauss wrote: The problem with sorting is that the following: [3,5,6,6,2,1,2,5,3] will then become [1,2,3,5,6] or [6,5,3,2,1] and not: [3,5,6,2,1] which would be what you'd wanna use

Re: uniq and array of enum members (That are all strings)

2019-01-16 Thread bauss via Digitalmars-d-learn
On Wednesday, 16 January 2019 at 16:40:34 UTC, Alex wrote: On Wednesday, 16 January 2019 at 16:21:12 UTC, bauss wrote: On Wednesday, 16 January 2019 at 16:12:28 UTC, H. S. Teoh wrote: On Wed, Jan 16, 2019 at 03:57:49PM +, bauss via Digitalmars-d-learn wrote: Is there a way to achieve

Re: uniq and array of enum members (That are all strings)

2019-01-16 Thread bauss via Digitalmars-d-learn
On Wednesday, 16 January 2019 at 16:35:04 UTC, H. S. Teoh wrote: On Wed, Jan 16, 2019 at 04:21:12PM +, bauss via Digitalmars-d-learn wrote: On Wednesday, 16 January 2019 at 16:12:28 UTC, H. S. Teoh wrote: [...] > .uniq only works on adjacent identical elements. You should > sor

Re: uniq and array of enum members (That are all strings)

2019-01-16 Thread bauss via Digitalmars-d-learn
On Wednesday, 16 January 2019 at 16:12:28 UTC, H. S. Teoh wrote: On Wed, Jan 16, 2019 at 03:57:49PM +, bauss via Digitalmars-d-learn wrote: Is there a way to achieve the following: [...] enum Foo : string { a = "aa", b = "bb", c = "cc" } voi

uniq and array of enum members (That are all strings)

2019-01-16 Thread bauss via Digitalmars-d-learn
Is there a way to achieve the following: import std.stdio; import std.algorithm : uniq; import std.array : array; enum Foo : string { a = "aa", b = "bb", c = "cc" } void main() { auto a = [Foo.a, Foo.b, Foo.a, Foo.b, Foo.c]; auto b = a.uniq; writeln(b); //

Re: Reversing a string

2019-01-11 Thread bauss via Digitalmars-d-learn
On Friday, 11 January 2019 at 11:15:05 UTC, Mike James wrote: On Friday, 11 January 2019 at 09:41:30 UTC, bauss wrote: On Friday, 11 January 2019 at 08:25:41 UTC, Seb wrote: On Friday, 11 January 2019 at 08:05:39 UTC, AndreasDavour wrote: Hi. I've just started to learn some D, so maybe this

Re: Reversing a string

2019-01-11 Thread bauss via Digitalmars-d-learn
On Friday, 11 January 2019 at 08:25:41 UTC, Seb wrote: On Friday, 11 January 2019 at 08:05:39 UTC, AndreasDavour wrote: Hi. I've just started to learn some D, so maybe this question is extremely stupid, but please bear with me. [...] Use .retro - it is also lazy and won't allocate:

Re: Vibe.d throw link error

2019-01-05 Thread bauss via Digitalmars-d-learn
On Saturday, 5 January 2019 at 18:44:33 UTC, greatsam4sure wrote: On Friday, 4 January 2019 at 09:56:14 UTC, bauss wrote: On Friday, 4 January 2019 at 09:48:55 UTC, greatsam4sure wrote: On Thursday, 3 January 2019 at 04:57:57 UTC, Me wrote: On Thursday, 3 January 2019 at 00:23:50 UTC,

Re: Vibe.d throw link error

2019-01-04 Thread bauss via Digitalmars-d-learn
On Friday, 4 January 2019 at 09:48:55 UTC, greatsam4sure wrote: On Thursday, 3 January 2019 at 04:57:57 UTC, Me wrote: On Thursday, 3 January 2019 at 00:23:50 UTC, greatsam4sure wrote: On Wednesday, 2 January 2019 at 21:46:57 UTC, bauss wrote: Error: linker exit with status 1 Dmd failed

Re: reimplementing an interface in a derived class

2019-01-04 Thread bauss via Digitalmars-d-learn
On Friday, 4 January 2019 at 09:53:18 UTC, Alex wrote: I assume the move method of an Animal is not abstract, and therefore I supposed, casting to this type explicitly should restore this very non-abstract behavior. But this is not the case. And the final/virtual thing above explains this to

Re: reimplementing an interface in a derived class

2019-01-04 Thread bauss via Digitalmars-d-learn
On Friday, 4 January 2019 at 08:40:04 UTC, Alex wrote: On Friday, 4 January 2019 at 02:13:27 UTC, Neia Neutuladh wrote: I can't think of a single class system that works like that. C++, Java, C#, Dart, and TypeScript all work like D here. GObject in C works like D. In the example below, the

Re: reimplementing an interface in a derived class

2019-01-03 Thread bauss via Digitalmars-d-learn
On Friday, 4 January 2019 at 00:19:05 UTC, Alex wrote: On Friday, 4 January 2019 at 00:15:28 UTC, Neia Neutuladh wrote: On Thu, 03 Jan 2019 23:44:15 +, Alex wrote: I assume that is another bug and has nothing to do with interfaces... B.foo is both overriding A.foo and implementing D.foo,

Re: reimplementing an interface in a derived class

2019-01-03 Thread bauss via Digitalmars-d-learn
On Thursday, 3 January 2019 at 22:30:48 UTC, kdevel wrote: https://dlang.org/spec/interface.html #11 has this code example: ``` interface D { int foo(); } class A : D { int foo() { return 1; } } class B : A, D { override int foo() { return 2; } } ... B b = new B(); b.foo();

Re: Vibe.d throw link error

2019-01-03 Thread bauss via Digitalmars-d-learn
On Thursday, 3 January 2019 at 00:23:50 UTC, greatsam4sure wrote: On Wednesday, 2 January 2019 at 21:46:57 UTC, bauss wrote: Error: linker exit with status 1 Dmd failed with exit code 1 This is all the compiler emit I'm not asking for the error or what the compiler emits. I'm asking how

Re: Vibe.d throw link error

2019-01-02 Thread bauss via Digitalmars-d-learn
On Wednesday, 2 January 2019 at 20:52:26 UTC, greatsam4sure wrote: I am using windows 10. I could not run vibe project. It just give me the error: Error: linker exit with status 1 Dmd failed with exit code 1 I have use different dmd from 0.080 till 0.083. The same error. What is the

Re: DSFML linking fails

2018-12-25 Thread bauss via Digitalmars-d-learn
On Monday, 24 December 2018 at 10:08:25 UTC, Dmitriy wrote: Hello. I'm using https://github.com/Jebbs/DSFML library [...] Create an issue here: https://github.com/Jebbs/DSFML/issues

Re: class template conflict

2018-12-25 Thread bauss via Digitalmars-d-learn
On Monday, 24 December 2018 at 00:24:05 UTC, Michelle Long wrote: More simple is : do not use the same identifier ;) The whole point is to use the same identifier ;/ I think there is a bigger problem at stake here in terms of software architecture. What's the point needed for them to have

Re: Mysteries of the Underscore

2018-12-24 Thread bauss via Digitalmars-d-learn
On Monday, 24 December 2018 at 11:18:44 UTC, Ron Tarrant wrote: I found a mention that in the definition of a delegate, a function parameter and its type could be replaced by an underscore: myTestRig.addOnDestroy(delegate void(Widget w) { quitApp(); } ); became:

Re: Mixin operator 'if' directly

2018-12-22 Thread bauss via Digitalmars-d-learn
On Saturday, 22 December 2018 at 03:44:09 UTC, Timoses wrote: Awesome hack! Being a hack, it would be even nicer if it worked ouf of the box: mixin template foo(bool b) { int _impl() { writeln(b); return int.init; } int _ipml2 = _impl(); } vs mixin template

Re: D1 question: does anyone has bud (build) tool available for download?

2018-12-21 Thread bauss via Digitalmars-d-learn
On Friday, 21 December 2018 at 13:25:17 UTC, jicman wrote: There used to be a tool called 'build', later named 'bud', that would build applications. Does anyone know where I can download it? I tried the old spot, dsource, http://www.dsource.org/projects/build but the links for download are

Re: Mixin operator 'if' directly

2018-12-20 Thread bauss via Digitalmars-d-learn
On Thursday, 20 December 2018 at 16:23:39 UTC, H. S. Teoh wrote: On Thu, Dec 20, 2018 at 11:04:19AM +, bauss via Digitalmars-d-learn wrote: [...] [...] [...] Me too! This is awesome! This basically lets you insert arbitrary code via mixin templates with essentially no restrictions

Re: Mixin operator 'if' directly

2018-12-20 Thread bauss via Digitalmars-d-learn
On Wednesday, 19 December 2018 at 15:40:50 UTC, Neia Neutuladh wrote: On Wed, 19 Dec 2018 15:12:14 +, bauss wrote: That's assuming that it's compile-time data though. If not then you can't do what you want to do. What you can do is wrap it in a function in the mixin template which you

Re: Mixin operator 'if' directly

2018-12-19 Thread bauss via Digitalmars-d-learn
On Wednesday, 19 December 2018 at 15:09:47 UTC, bauss wrote: On Wednesday, 19 December 2018 at 13:37:17 UTC, Andrey wrote: Hi, Here is a template mixin: mixin template create(alias input, uint index, alias data) { if(input.length < index) return; // ... some code } When I try to

Re: Mixin operator 'if' directly

2018-12-19 Thread bauss via Digitalmars-d-learn
On Wednesday, 19 December 2018 at 13:37:17 UTC, Andrey wrote: Hi, Here is a template mixin: mixin template create(alias input, uint index, alias data) { if(input.length < index) return; // ... some code } When I try to compile it, I get: Error: declaration expected, not if Is it

Re: Doubt about this book: The D Programming Language

2018-12-16 Thread bauss via Digitalmars-d-learn
On Sunday, 16 December 2018 at 19:57:08 UTC, Steven Schveighoffer wrote: I hope you feel right at home here :) But I must warn you, if you're anything like me, you will hate having to go back to another language. -Steve I think that's how most people start to feel when they start using D

Re: Orphan format arguments: args[0..1]

2018-12-16 Thread bauss via Digitalmars-d-learn
On Sunday, 16 December 2018 at 00:34:48 UTC, Ali Çehreli wrote: This one confused me until I decided to talk to a rubber ducky: import std.string; void main() { auto s = "%s is a good number".format(42); } Fine; it works... Then the string becomes too long and I split it: auto s =

Re: is(ElementType!(char[2]) == dchar - why?

2018-12-11 Thread bauss via Digitalmars-d-learn
On Tuesday, 11 December 2018 at 18:10:48 UTC, H. S. Teoh wrote: On Wed, Dec 12, 2018 at 06:56:46AM +1300, rikki cattermole via Digitalmars-d-learn wrote: On 12/12/2018 6:51 AM, Denis Feklushkin wrote: > import std.stdio; > import std.range.primitives; > > void main() > { >     writeln( >    

Re: D & C++ class question

2018-11-29 Thread bauss via Digitalmars-d-learn
On Thursday, 29 November 2018 at 17:12:28 UTC, kinke wrote: On Thursday, 29 November 2018 at 16:24:58 UTC, bauss wrote: Are there no support for references with mangling in D? Like what about int&? Of course, that's `ref int`. But a `ref CppClass` is C++-mangled as `CppClass* &`. I was

Re: D & C++ class question

2018-11-29 Thread bauss via Digitalmars-d-learn
On Wednesday, 28 November 2018 at 13:42:43 UTC, Nicholas Wilson wrote: On Wednesday, 28 November 2018 at 13:13:40 UTC, bauss wrote: Well unfortunately I cannot control the C++ side of things, but I assume that it'll work properly with extern(C++) so I guess I will just go ahead and try and see

Re: How to center dlangui Window on screen

2018-11-28 Thread bauss via Digitalmars-d-learn
On Wednesday, 28 November 2018 at 23:07:50 UTC, greatsam4sure wrote: On Wednesday, 28 November 2018 at 17:23:21 UTC, Edgar Huckert wrote: On Wednesday, 28 November 2018 at 08:55:11 UTC, greatsam4sure wrote: I am learning Dlang and Dlangui. I encounter, a little problem on: how to center

Re: D & C++ class question

2018-11-28 Thread bauss via Digitalmars-d-learn
On Wednesday, 28 November 2018 at 13:42:43 UTC, Nicholas Wilson wrote: On Wednesday, 28 November 2018 at 13:13:40 UTC, bauss wrote: Well unfortunately I cannot control the C++ side of things, but I assume that it'll work properly with extern(C++) so I guess I will just go ahead and try and see

  1   2   3   4   >