Re: Allowing Expressions such as (low value high)

2014-09-07 Thread nikki via Digitalmars-d-learn
On Thursday, 4 September 2014 at 20:03:57 UTC, Nordlöw wrote: Are there any programming languages that extend the behaviour of comparison operators to allow expressions such as if (low value high) ? This syntax is currently disallowed by DMD. I'm aware of the risk of a programmer

Re: basic question about adresses and values in structs

2014-09-04 Thread nikki via Digitalmars-d-learn
thanks! just what I needed, with some stumbling I managed to get everything working as intended: using a pointer variable to save an adres of a function, then dereferencing to use it. Now I am wondering when to use the ** ? for example I found this function over at

Re: literate programming in D

2014-09-04 Thread nikki via Digitalmars-d-learn
On Friday, 29 August 2014 at 23:41:00 UTC, bearophile wrote: nikki: I use it to change my d sourcefile slightly (into valid markdown) then I use a node module (ghmd) to make sortof sexy html from that. Are you going to add popups of the types as in the F# page I have linked? Bye,

Re: literate programming in D

2014-09-04 Thread nikki via Digitalmars-d-learn
I should have read your post more carefully, the 'tagging' in the code is not really what I am after, I want the file including the documentation to just be a valid d file, does'nt mean however that there aren't ways of solving the issue without such precise tagging I guess

Re: basic question about adresses and values in structs

2014-09-04 Thread nikki via Digitalmars-d-learn
On Thursday, 4 September 2014 at 14:00:14 UTC, Ali Çehreli wrote: On 09/04/2014 02:54 AM, nikki wrote: a pointer variable to save an adres of a function, then dereferencing to use it. If possible, even in C, I would recommend using a 'function pointer' for that. However, there are cases

basic question about adresses and values in structs

2014-09-01 Thread nikki via Digitalmars-d-learn
so I am still very new to structs and and * adress and pointer stuff, I have this basic code : struct S { int value = 0; } void func(S thing){ writeln(thing); //BFC52B44 thing.value = 100; } S guy = {value:200}; writeln(guy); //BFC52CCC

Re: basic question about adresses and values in structs

2014-09-01 Thread nikki via Digitalmars-d-learn
sorry could have quicker just googled it thanks!

Re: basic question about adresses and values in structs

2014-09-01 Thread nikki via Digitalmars-d-learn
ah so much cleaner then the mess I was almost into ;) thanks

getting the adress of a function by its name in string format

2014-08-30 Thread nikki via Digitalmars-d-learn
I would like to use json/or any other format for defining behavior trees. in that file format I can only use strings currently I just use the symbol directly but I was wondering how to 'find' them otherwise. float EAT_FOOD_DECISION(Agent agent){ return 1.0 - agent.hunger; } bool

Re: getting the adress of a function by its name in string format

2014-08-30 Thread nikki via Digitalmars-d-learn
On Saturday, 30 August 2014 at 17:08:30 UTC, Philippe Sigaud via Digitalmars-d-learn wrote: instead I would like to use EAT_FOOD_DECISION and EAT_FOOD_BEHAVIOUR and get the functions? Is that possible somehow? If all your functions had the same signature, you could use an associative array

Re: literate programming in D

2014-08-29 Thread nikki via Digitalmars-d-learn
I wasn't too happy about it and I wrote my own little parse thingie and have a literate version nice and meta and small and sloppy ;) http://nikkikoole.github.io/docs/dokidokDOC.html I use it to change my d sourcefile slightly (into valid markdown) then I use a node module (ghmd) to make

Re: literate programming in D

2014-08-29 Thread nikki via Digitalmars-d-learn
On Friday, 29 August 2014 at 23:41:00 UTC, bearophile wrote: nikki: Are you going to add popups of the types as in the F# page I have linked? Bye, bearophile Now then you could remove the sortof from that sexy

C style function pointers

2014-08-26 Thread nikki via Digitalmars-d-learn
I am trying top port this code : float interpolate( float from, float to, float amount, float (*easing)(float) ) { return from + ( to-from )*( easing( amount ) ); } float linear_interpolation( float p ) { return p; } the float (*easing)(float) part needs to be rewritten as float

Re: C style function pointers

2014-08-26 Thread nikki via Digitalmars-d-learn
thanks, that worked, I need to grow a feeling for those * and

literate programming in D

2014-08-26 Thread nikki via Digitalmars-d-learn
I've been googling without luck, is there a way to do literate programming in D?, similar to how it's done in Coffeescript ? http://www.coffeescriptlove.com/2013/02/literate-coffeescript.html basically me writing comments around code and some parser that creates styled documents from that

Re: literate programming in D

2014-08-26 Thread nikki via Digitalmars-d-learn
Aha, then It's quite safe to assume it won't be coming back I guess, then I might need to cook up some homebrew alternative. thanks for the info

Re: literate programming in D

2014-08-26 Thread nikki via Digitalmars-d-learn
That would work very fine, thanks sir!

struct or class

2014-08-24 Thread nikki via Digitalmars-d-learn
I come from languages that don't offer structs, I have this json load function that has to keep some data and intuitively I've written a struct, I've read about the differences, heap vs stack, value vs reference, but know I think i am overthinking it. Is this decent: bool loadFromFile

'idiomatic' porting of c and or c++ code that does NULL checking

2014-08-23 Thread nikki via Digitalmars-d-learn
I am learning SDL by following the lazyfoo SDL2 tuorials, I am alos new to D so I have a question: I the lazyfoo tutorials there are many functions that have a bool success whiich gets set at various places when something goes wrong to be returned afterwards.

Re: 'idiomatic' porting of c and or c++ code that does NULL checking

2014-08-23 Thread nikki via Digitalmars-d-learn
Oops well writing the above post made me realise what to look for : http://dlang.org/errors.html ;)

Re: 'idiomatic' porting of c and or c++ code that does NULL checking

2014-08-23 Thread nikki via Digitalmars-d-learn
On Saturday, 23 August 2014 at 10:29:04 UTC, ketmar via Digitalmars-d-learn wrote: On Sat, 23 Aug 2014 10:19:58 + nikki via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote: don't use '==' to check for nulls. the right way is: if (foo is null) {} if (bar !is null

Re: getting autocompletion in emacs

2014-08-08 Thread nikki via Digitalmars-d-learn
It was quite some journey I got it working now ;) https://github.com/Hackerpilot/DCD/issues/153

getting autocompletion in emacs

2014-08-07 Thread nikki via Digitalmars-d-learn
I want to learn SDL2 and learn D at the same time, for the SDL2 part autocompletion would be very nice. I've found DCD but can't get it working (not finding symbols or declarations) at the moment but I was wondering if there are any alternatives, it's hard to google for d things and emacs,

Re: building a D app with multiple source files

2014-08-05 Thread nikki via Digitalmars-d-learn
edit : btw, I understand how to build an app that conscists out of a few source files, I'd just do 'dmd file1.d file2.d' I amtalking here about the situation where that's unpractical because of the amount and folder structure.

building a D app with multiple source files

2014-08-05 Thread nikki via Digitalmars-d-learn
Hello, I am completely new to D and have been paying around with the tutorials, some docs and little test programs. Now I want to try and use https://github.com/elvisxzhou/artemisd for little gamedev experiment but I am running into build issues. That project doesn't have a Makefile in the repo,

Re: building a D app with multiple source files

2014-08-05 Thread nikki via Digitalmars-d-learn
What issues have you had with rdmd? The library seems to have a package.json file, so you could also try dub: http://code.dlang.org/download nikki@crunchbang:~/projects/d/artemisd$ rdmd example/source/app.d example/source/app.d(5): Error: module all is in file 'artemisd/all.d' which

Re: building a D app with multiple source files

2014-08-05 Thread nikki via Digitalmars-d-learn
Correction: rdmd -Isource example/source/app.d that one worked, woohoo thanks. what did the -Isource do? it's not in the 'rdmd --help'

Re: building a D app with multiple source files

2014-08-05 Thread nikki via Digitalmars-d-learn
On Tuesday, 5 August 2014 at 07:57:57 UTC, Vladimir Panteleev wrote: On Tuesday, 5 August 2014 at 07:51:53 UTC, nikki wrote: Correction: rdmd -Isource example/source/app.d that one worked, woohoo thanks. what did the -Isource do? it's not in the 'rdmd --help' You'll find it in dmd's

Re: building a D app with multiple source files

2014-08-05 Thread nikki via Digitalmars-d-learn
The switch itself is -I, not -Ipath. 'path' indicates a parameter for which you need to substitute something, in this case a directory path. It should be the root folder for the source modules you want to add to the search path. In this case, for artemisd, the source files are in the