Re: Can't recreate a range?

2020-04-30 Thread Casey via Digitalmars-d-learn
On Thursday, 30 April 2020 at 18:30:14 UTC, H. S. Teoh wrote: On Thu, Apr 30, 2020 at 06:05:55PM +, Paul Backus via Digitalmars-d-learn wrote: [...] Doing work in popFront instead of front is usually an anti-pattern, since it forces eager evaluation of the next element even when that elemen

Re: Can't recreate a range?

2020-04-30 Thread Casey via Digitalmars-d-learn
On Thursday, 30 April 2020 at 16:21:05 UTC, Steven Schveighoffer wrote: I would say part of the issue is that you are doing all your work in front and not popFront. What happens is that Appender is a pointer-to-implementation struct, and the compiler will allocate the first one shared amongst

Re: Can't recreate a range?

2020-04-30 Thread Casey via Digitalmars-d-learn
On Thursday, 30 April 2020 at 15:42:03 UTC, Casey wrote: I'll give it a try when I get back to it (fixing lint issues), but are you sure that's the issue? In popFront, I recreate the appender. So, the appender should be clear before the empty check after it processes the last o

Re: Can't recreate a range?

2020-04-30 Thread Casey via Digitalmars-d-learn
On Thursday, 30 April 2020 at 13:23:25 UTC, Paul Backus wrote: Using a default value like this means that it will be shared among all instances of the struct. Instead, you should set `buff = appender!string` in the constructor, so that each struct will have its own appender. I'll give it a tr

Re: Can't recreate a range?

2020-04-30 Thread Casey via Digitalmars-d-learn
On Wednesday, 29 April 2020 at 22:32:00 UTC, Simen Kjærås wrote: I mean, it might be you messed up in posting this, but having an empty popFront and expecting it to do something is a tad optimistic. I was just trying to get the example to a very minimal state. I just added more descriptive c

Re: Can't recreate a range?

2020-04-30 Thread Casey via Digitalmars-d-learn
Here's a minimal code example that duplicates the issue: import std.array, std.range, std.stdio, std.traits, std.string; auto readStream(Range)(auto ref Range r) if (isInputRange!(Unqual!Range)) { struct StreamRange(Range) { alias R = Unqual!Range;

Can't recreate a range?

2020-04-29 Thread Casey via Digitalmars-d-learn
So, I'm trying to run some tests and I had code that looks similar to this: unittest { auto range = readStream(File("test_data/multiple.xml").byLine); int count = 0; while (!range.empty) { count++; range.popFront(); }

Re: Dub and unit-threaded import problem

2016-03-05 Thread Casey via Digitalmars-d-learn
On Saturday, 5 March 2016 at 18:01:48 UTC, Atila Neves wrote: On Saturday, 5 March 2016 at 15:05:50 UTC, Casey wrote: Hello, I'm just starting a small project with dub and unit-threaded, but I'm getting an issue where the file "unit_threaded.d" cannot be found. [

Re: Dub and unit-threaded import problem

2016-03-05 Thread Casey via Digitalmars-d-learn
On Saturday, 5 March 2016 at 18:01:48 UTC, Atila Neves wrote: On Saturday, 5 March 2016 at 15:05:50 UTC, Casey wrote: Hello, I'm just starting a small project with dub and unit-threaded, but I'm getting an issue where the file "unit_threaded.d" cannot be found. [

Dub and unit-threaded import problem

2016-03-05 Thread Casey via Digitalmars-d-learn
Hello, I'm just starting a small project with dub and unit-threaded, but I'm getting an issue where the file "unit_threaded.d" cannot be found. Details: DMD version: DMD64 2.070.0 Dub version: 0.9.24 Dub Config: { "name": "pst", "targetType": "executable", "targetPath": "bin",

Re: Basically want to make a macro script

2014-11-13 Thread Casey via Digitalmars-d-learn
On Friday, 14 November 2014 at 03:51:17 UTC, Adam D. Ruppe wrote: On Friday, 14 November 2014 at 02:08:22 UTC, Casey wrote: Well, I edited the code to add the chat button, and as I feared it didn't recignise it in game. However, if I manually press the chat button it'll work f

Re: Basically want to make a macro script

2014-11-13 Thread Casey via Digitalmars-d-learn
Aha! I found a sleep command. On this page here: http://forum.dlang.org/thread/diuepu$2ebg$1...@digitaldaemon.com Looks like I'd do something like this [code] import std.c.time msleep(1) [/code] Now I'm looking into if there's a way to send a key down, and then up. I don't think this will

Re: Basically want to make a macro script

2014-11-13 Thread Casey via Digitalmars-d-learn
Well, I edited the code to add the chat button, and as I feared it didn't recignise it in game. However, if I manually press the chat button it'll work fine, so all I need to do is add that delay in, then fine tune it to add all of the different messages I need now. 1)What part of this do I

Re: Basically want to make a macro script

2014-11-13 Thread Casey via Digitalmars-d-learn
On Thursday, 13 November 2014 at 23:59:59 UTC, Casey wrote: On Thursday, 13 November 2014 at 23:54:13 UTC, Casey wrote: All on the same line... That makes a lot more sense. Sorry, I probably just didn't understand what you meant. I'll do that now and see if I can't get this

Re: Basically want to make a macro script

2014-11-13 Thread Casey via Digitalmars-d-learn
On Thursday, 13 November 2014 at 23:54:13 UTC, Casey wrote: All on the same line... That makes a lot more sense. Sorry, I probably just didn't understand what you meant. I'll do that now and see if I can't get this working. Then I'll try to get it working in a game.

Re: Basically want to make a macro script

2014-11-13 Thread Casey via Digitalmars-d-learn
All on the same line... That makes a lot more sense. Sorry, I probably just didn't understand what you meant. I'll do that now and see if I can't get this working. Then I'll try to get it working in a game. I think I'll have to come up with something to add a delay in between the chat key d

Re: Basically want to make a macro script

2014-11-13 Thread Casey via Digitalmars-d-learn
On Thursday, 13 November 2014 at 22:28:43 UTC, Israel wrote: On Thursday, 13 November 2014 at 22:20:58 UTC, Casey wrote: On Thursday, 13 November 2014 at 21:56:48 UTC, Casey wrote: On Thursday, 13 November 2014 at 16:04:43 UTC, Adam D. Ruppe wrote: On Thursday, 13 November 2014 at 07:01:08 UTC

Re: Basically want to make a macro script

2014-11-13 Thread Casey via Digitalmars-d-learn
I also just now got it to CD to the right directory. I had a suspicion it was having an issue with the second drive, and it was. Just had to type D: and it did the rest.

Re: Basically want to make a macro script

2014-11-13 Thread Casey via Digitalmars-d-learn
On Thursday, 13 November 2014 at 21:56:48 UTC, Casey wrote: On Thursday, 13 November 2014 at 16:04:43 UTC, Adam D. Ruppe wrote: On Thursday, 13 November 2014 at 07:01:08 UTC, Rikki Cattermole wrote: I did find this [0]. I don't know what state its in for compilating/running ext. But it

Re: Basically want to make a macro script

2014-11-13 Thread Casey via Digitalmars-d-learn
On Thursday, 13 November 2014 at 16:04:43 UTC, Adam D. Ruppe wrote: On Thursday, 13 November 2014 at 07:01:08 UTC, Rikki Cattermole wrote: I did find this [0]. I don't know what state its in for compilating/running ext. But it might give you a good starting point. [0] https://github.com/pytho

Re: Basically want to make a macro script

2014-11-12 Thread Casey via Digitalmars-d-learn
On Thursday, 13 November 2014 at 02:58:02 UTC, Rikki Cattermole wrote: On 13/11/2014 3:45 p.m., Israel wrote: On Thursday, 13 November 2014 at 02:00:11 UTC, Rikki Cattermole wrote: On 13/11/2014 2:37 p.m., Casey wrote: On Thursday, 13 November 2014 at 01:35:28 UTC, Israel wrote: On Wednesday

Re: Basically want to make a macro script

2014-11-12 Thread Casey via Digitalmars-d-learn
On Thursday, 13 November 2014 at 01:35:28 UTC, Israel wrote: On Wednesday, 12 November 2014 at 23:40:09 UTC, Casey wrote: I'll look into that, it seems as it might work. If D would be too hard to get working, what would you recommend? I would assume Ptyhon or C++ would be good ch

Re: Basically want to make a macro script

2014-11-12 Thread Casey via Digitalmars-d-learn
On Wednesday, 12 November 2014 at 23:35:33 UTC, Israel wrote: On Wednesday, 12 November 2014 at 19:43:49 UTC, Casey wrote: On Wednesday, 12 November 2014 at 19:29:26 UTC, Israel wrote: On Wednesday, 12 November 2014 at 04:56:40 UTC, Casey wrote: also, you came to the right place. PB is

Re: Basically want to make a macro script

2014-11-12 Thread Casey via Digitalmars-d-learn
On Wednesday, 12 November 2014 at 19:29:26 UTC, Israel wrote: On Wednesday, 12 November 2014 at 04:56:40 UTC, Casey wrote: also, you came to the right place. PB is extremely paranoid and even more so about autohokey, so if you program your own native macro, its not very likely it will catch it

Re: Basically want to make a macro script

2014-11-12 Thread Casey via Digitalmars-d-learn
On Wednesday, 12 November 2014 at 08:02:06 UTC, ketmar via Digitalmars-d-learn wrote: On Wed, 12 Nov 2014 04:56:39 + Casey via Digitalmars-d-learn wrote: D has nothing to do with your task, WinAPI does. and you'll need alot of expirience in reverse engineering, 'cause f...

Basically want to make a macro script

2014-11-11 Thread Casey via Digitalmars-d-learn
/Long/ story short, I want to pretty much make a macro using this program. I don't really have time to explain in further detail at the moment, but /no/ macro program out there will do what I'm trying to do. I want to basically make it so that when I press a hotkey, it'll send an in game chat

Re: Variable Naming Issue (Conflicts?)

2014-04-22 Thread Casey via Digitalmars-d-learn
re. Anyway, thanks. Casey

Re: Variable Naming Issue (Conflicts?)

2014-04-22 Thread Casey via Digitalmars-d-learn
On Tuesday, 22 April 2014 at 19:38:09 UTC, bearophile wrote: Casey: My question is, is there a way I can prevent this conflict from occurring without affecting what the struct will look like? The usual strategy is to append an underscore. (I think C# uses a @ prefix). Bye, bearophile

Variable Naming Issue (Conflicts?)

2014-04-22 Thread Casey via Digitalmars-d-learn
Hello, I'm working on some code where I'm trying to generate structs that map to JSON documents via a mixin. That part works except when specific variable gets created. Below is the error that I'm getting: source/objects.d-mixin-70(75): Error: no identifier for declarator string s

Re: Issue calling methods using std.concurrency

2012-04-25 Thread Casey
Stanislav: I think you just hit the nail on the head with the shared reference to this. I didn't even think of that as the error message made me think of the parameter being shared. As for solving it, I'll have to think about it. I was hoping to just have a single queue class (Or any other i

Re: Issue calling methods using std.concurrency

2012-04-23 Thread Casey
Before: 0 After: 42 Ali Ali, I actually did print out the value being passed successfully. It's just that when I used the queue methods (enqueue and dequeue), it get this error. The queue itself is shared, but none of the methods are expecting a shared value nor do I believe they should. Casey

Issue calling methods using std.concurrency

2012-04-22 Thread Casey
Hello, I'm getting some errors when I wrap a struct that I've written with another struct. Here are the errors I'm getting: tqueue.d(14): Error: function queue.Queue!(int).Queue.enqueue (int value) is not callable using argument types (int) shared tqueue.d(15): Error: function queue.Queue!