Re: Newbie question: Return a locally allocated variable

2020-09-14 Thread Fitz via Digitalmars-d-learn
On Monday, 14 September 2020 at 16:44:14 UTC, Adam D. Ruppe wrote: This is a common mistake with people coming from C++. A D class is more like a Java class - it is automatically a reference. So your class Bob here in D would actually be represented as `Bob*` in C++. Thus when you define `B

Re: Newbie question: Return a locally allocated variable

2020-09-14 Thread Adam D. Ruppe via Digitalmars-d-learn
On Monday, 14 September 2020 at 16:29:11 UTC, Fitz wrote: I expect the following code below to create 10 items with 10 different addresses, instead they all have the same address? You are taking the address of the local variable holding reference, not the reference itself. class Bob { } Bo

Newbie question: Return a locally allocated variable

2020-09-14 Thread Fitz via Digitalmars-d-learn
I expect the following code below to create 10 items with 10 different addresses, instead they all have the same address? import std.stdio; class Bob { } void main() { for (auto i = 0; i < 10; i++) { auto pBob = bobFactory(); writefln("bob @ %x\n", pBob); } } Bob *bobF

Re: simple newbie question

2015-11-22 Thread Adam D. Ruppe via Digitalmars-d-learn
On Sunday, 22 November 2015 at 09:55:10 UTC, fred wrote: How to generate temporary files so compilation time speeds up. Normal compilation only produce obj, exe. If what i mean is that if we compile the files that unchanged, dmd will look for that temporary files instead of .d files. The .d

Re: simple newbie question

2015-11-22 Thread Adam D. Ruppe via Digitalmars-d-learn
On Sunday, 22 November 2015 at 09:41:42 UTC, fred wrote: So why most d library still static link. It generally results in smaller and faster distributions and less hassle for the typical D use case today.

simple newbie question

2015-11-22 Thread fred via Digitalmars-d-learn
How to generate temporary files so compilation time speeds up. Normal compilation only produce obj, exe. If what i mean is that if we compile the files that unchanged, dmd will look for that temporary files instead of .d files.

simple newbie question

2015-11-22 Thread fred via Digitalmars-d-learn
Hi. Dll or shared library is important feature of software development. So why most d library still static link. I am sorry for my stupid question. Thanks.

Re: newbie question about variables in slices..

2014-05-12 Thread Jonathan M Davis via Digitalmars-d-learn
On Mon, 12 May 2014 20:12:41 + Kai via Digitalmars-d-learn wrote: > Hi I am trying to iterate over a mmfile (ubyte[]) and convert it > to uint > > void main(){ > MmFile inn = new MmFile("mmData.dat"); > ubyte[] arr = cast(ubyte[])inn[]; > for(ulong index = 0; index ulong stop = in

newbie question about variables in slices..

2014-05-12 Thread Kai via Digitalmars-d-learn
Hi I am trying to iterate over a mmfile (ubyte[]) and convert it to uint void main(){ MmFile inn = new MmFile("mmData.dat"); ubyte[] arr = cast(ubyte[])inn[]; for(ulong index = 0; indexError: template std.bitmanip.littleEndianToNative cannot deduce function from argument

Re: newbie question about dub

2014-05-07 Thread Mike Parker via Digitalmars-d-learn
On 5/6/2014 8:29 PM, Oleg wrote: QUESTION: How to define the dfuse library version of I'm doing it wrong way? I believe you might find this thread[1] in the dub forum helpful. [1] http://forum.rejectedsoftware.com/groups/rejectedsoftware.dub/thread/1328/

Re: newbie question about dub

2014-05-07 Thread Mike Parker via Digitalmars-d-learn
On 5/7/2014 10:41 PM, Mike Parker wrote: On 5/6/2014 8:29 PM, Oleg wrote: QUESTION: How to define the dfuse library version of I'm doing it wrong way? I believe you might find this thread[1] in the dub forum helpful. Sorry, wrong link. It should be: http://forum.rejectedsoftware.com/groups

newbie question about dub

2014-05-06 Thread Oleg via Digitalmars-d-learn
Hello. I'm developing library and want to add an examples to the same project. If I understand corecly, DUB allows to build a dependencies from another folder and use them to build a program. I've tried two ways - subConfigurations and subPackages. For example, there is subConfigurations confi

Re: Newbie Question: SOAP Module

2013-11-22 Thread Rick Catano
On Tuesday, 19 November 2013 at 22:05:36 UTC, Jacek Furmankiewicz wrote: is there any particular reason you are forced to use SOAP? It is more or less an obsolete and generally frowned upon approach. if you were willing to adopt REST, vibe.d seems to have some nice functionality for creating

Re: Newbie Question: SOAP Module

2013-11-19 Thread Jacek Furmankiewicz
is there any particular reason you are forced to use SOAP? It is more or less an obsolete and generally frowned upon approach. if you were willing to adopt REST, vibe.d seems to have some nice functionality for creating REST APIs. Look at the 'Routing' section here: http://vibed.org/docs#h

Re: Newbie Question: SOAP Module

2013-11-19 Thread Rick Catano
On Tuesday, 19 November 2013 at 20:38:00 UTC, Adam D. Ruppe wrote: On Monday, 18 November 2013 at 23:49:56 UTC, Rick Catano wrote: My first question of the D language is, is there a SOAP module that I can consume web services with? I don't know, but I don't think so. Maybe it wouldn't be too

Re: Newbie Question: SOAP Module

2013-11-19 Thread Adam D. Ruppe
On Monday, 18 November 2013 at 23:49:56 UTC, Rick Catano wrote: My first question of the D language is, is there a SOAP module that I can consume web services with? I don't know, but I don't think so. Maybe it wouldn't be too hard to make out by combining http get (with curl or whatever) with

Re: Newbie Question: SOAP Module

2013-11-19 Thread Rick Catano
Anyone? I know it's a very basic question, but an honest and friendly answer will suffice.

Newbie Question: SOAP Module

2013-11-18 Thread Rick Catano
Hello all, I'm new here ( first post ), and looking to get into D Development. I currently use Python as my language of choice, but am looking to transition. My first question of the D language is, is there a SOAP module that I can consume web services with?

Re: newbie question: can D do this?

2011-12-22 Thread Philippe Sigaud
On Thu, Dec 22, 2011 at 16:45, clk wrote: > Philippe, > I don't understand the example below to simulate the list comprehension > syntax.  Are input1, input2 and input3 ranges? Yes, inputs are ranges. Sorry, I was perhaps a bit hasty in answering. The code is on github: https://github.com/Philip

Re: newbie question: Can D do this?

2011-12-22 Thread Philippe Sigaud
On Thu, Dec 22, 2011 at 16:37, clk wrote: > Philippe, > Thank you very much for your response.  It looks similar to what I've done > in javascript by wrapping all function arguments into a single object > literal but the D alternative you propose is a little to convoluted for a > beginner like me.

Re: newbie question: can D do this?

2011-12-22 Thread clk
;a*a+b*b == c*c&& a -- Message: 2 Date: Tue, 20 Dec 2011 21:45:26 +0100 From: Philippe Sigaud To: "digitalmars.D.learn" Subject: Re: newbie question: Can D do this? Message-ID: Content-Type: text/plain; charset=UTF-8 On Mon, Dec 19, 2011 at 17:17, clk wrote: Correct. As oth

Re: newbie question: Can D do this?

2011-12-22 Thread clk
Philippe, Thank you very much for your response. It looks similar to what I've done in javascript by wrapping all function arguments into a single object literal but the D alternative you propose is a little to convoluted for a beginner like me. Perhaps I'll understand it better after I'm don

Re: newbie question: Can D do this?

2011-12-21 Thread Christophe
Timon Gehr , dans le message (digitalmars.D.learn:31142), a écrit : > On 12/20/2011 03:18 PM, clk wrote: >> Thank you for your quick replies. I'm impressed by the helpfulness and >> dedication of the D community! >> Here's another one. Is there a way to pass arguments to functions by >> keyword as

Re: newbie question: Can D do this?

2011-12-21 Thread mta`chrono
In PHP frameworks often use $option arrays which are some kind of key value pairs. they are merged with the default valuzes inside the function. pro: - you can pass an argument by name - you only need to pass those who needed. cons: - hash arrays it should be possible to create a similar meth

Re: newbie question: Can D do this?

2011-12-20 Thread Stewart Gordon
On 20/12/2011 20:36, Philippe Sigaud wrote: That is, it expects some values, then string/values couples as associative arrays. I've a recollection of seeing something like this in the PHP library, but I forget where. I believe it's used in some functions that have a lot of options to set, s

Re: newbie question: Can D do this?

2011-12-20 Thread Philippe Sigaud
On Mon, Dec 19, 2011 at 17:17, clk wrote: > 2) D doesn't  seem to support the list comprehension syntax available in > python and javascript.  Is this correct? > > [f(x) for x in list if condition] Correct. As other have said, it's doable by combining std functions. As fas as I know, we do not h

Re: newbie question: Can D do this?

2011-12-20 Thread Philippe Sigaud
> On 20/12/2011 14:18, clk wrote: >> Here's another one. Is there a way to pass arguments to functions by >> keyword as in the >> calls to f and g below? I remember a discussion about year ago or so. It seems doable to have some kind of function transformer (adaptor?) for this. from: int foo(in

Re: newbie question: Can D do this?

2011-12-20 Thread Steven Schveighoffer
On Tue, 20 Dec 2011 09:18:16 -0500, clk wrote: Thank you for your quick replies. I'm impressed by the helpfulness and dedication of the D community! Here's another one. Is there a way to pass arguments to functions by keyword as in the calls to f and g below? void f(int a = 0, int b = 1) {} v

Re: newbie question: Can D do this?

2011-12-20 Thread Timon Gehr
igitalmars-d-learn digest..." Today's Topics: 1. Re: newbie question: Can D do this? (Ali ?ehreli) 2. Re: newbie question: Can D do this? (Kai Meyer) 3. Re: newbie question: Can D do this? (Simen Kj?r?s) 4. Re: newbie question: Can D do this? (Ali ?ehreli) 5. Re: newbie questio

Re: newbie question: Can D do this?

2011-12-20 Thread clk
c.com When replying, please edit your Subject line so it is more specific than "Re: Contents of Digitalmars-d-learn digest..." Today's Topics: 1. Re: newbie question: Can D do this? (Ali ?ehreli) 2. Re: newbie question: Can D do this? (Kai Meyer) 3. Re: newbie question: Can

Re: newbie question: Can D do this?

2011-12-19 Thread Jakob Ovrum
On Monday, 19 December 2011 at 19:01:10 UTC, Simen Kjærås wrote: import std.typetuple : TypeTuple; import std.typecons : tuple; TypeTuple!(a, b) = tuple(b,a); There is a pull request implementing multiple variable declarations: https://github.com/D-Programming-Language/dmd/pull/341 However,

Re: newbie question: Can D do this?

2011-12-19 Thread Jonathan M Davis
On Monday, December 19, 2011 11:07:49 Ali Çehreli wrote: > That's a great article.[1] I hope that this chapter is more > beginner-friendly: > > http://ddili.org/ders/d.en/ranges.html Cool. One of the things that we're missing on the website is a solid article on ranges (I started such an article

Re: newbie question: Can D do this?

2011-12-19 Thread Ali Çehreli
On 12/19/2011 10:39 AM, Jonathan M Davis wrote: > it's a range (see > http://www.informit.com/articles/printerfriendly.aspx?p=1407357 for a general > explanation of the concept of ranges) That's a great article.[1] I hope that this chapter is more beginner-friendly: http://ddili.org/ders/d

Re: newbie question: Can D do this?

2011-12-19 Thread Simen Kjærås
On Mon, 19 Dec 2011 17:17:43 +0100, clk wrote: Hello, I'm new to this mailing list. I'm trying to learn D to eventually use it in production code. I'm a little bit intimidated by the fact that the topics in the d-learn list look rather advanced to a newbie like me. I have 3 fairly simple ques

Re: newbie question: Can D do this?

2011-12-19 Thread Kai Meyer
On 12/19/2011 09:17 AM, clk wrote: Hello, I'm new to this mailing list. I'm trying to learn D to eventually use it in production code. I'm a little bit intimidated by the fact that the topics in the d-learn list look rather advanced to a newbie like me. I have 3 fairly simple questions: 1) Does

Re: newbie question: Can D do this?

2011-12-19 Thread Ali Çehreli
On 12/19/2011 08:17 AM, clk wrote: > I'm a little bit intimidated by the fact that the topics in the d-learn > list look rather advanced to a newbie like me. We need more newbie topics here! :) > 1) Does D support something like the javascript 1.8 destructuring > assigment (multiple assigment i

Re: newbie question: Can D do this?

2011-12-19 Thread Jonathan M Davis
On Monday, December 19, 2011 11:17:43 clk wrote: > Hello, > I'm new to this mailing list. I'm trying to learn D to eventually use > it in production code. > I'm a little bit intimidated by the fact that the topics in the d-learn > list look rather advanced to a newbie like me. > I have 3 fairly sim

Re: newbie question: Can D do this?

2011-12-19 Thread simendsjo
On 19.12.2011 17:17, clk wrote: 1) Does D support something like the javascript 1.8 destructuring assigment (multiple assigment in python): [a, b] = [b, a]; I don't think so, but you can do something like this with templates: void swap(alias a, alias b)() { auto t = a; a = b; b = t

newbie question: Can D do this?

2011-12-19 Thread clk
Hello, I'm new to this mailing list. I'm trying to learn D to eventually use it in production code. I'm a little bit intimidated by the fact that the topics in the d-learn list look rather advanced to a newbie like me. I have 3 fairly simple questions: 1) Does D support something like the ja

Re: newbie question

2011-09-19 Thread bearophile
Timon Gehr: > As to > source-level compatibility, the only "guarantee" that Ds design gives is > that C code will either compile as D code with identical semantics or > not compile at all. In practice there are few differences, try to compile this in C and D, swapping the import/include: imp

Re: newbie question

2011-09-19 Thread Timon Gehr
On 09/18/2011 10:08 PM, %u wrote: does D compatibility with C restrict D from evolving ? Binary compatibility as in extern(C) certainly does not. As to source-level compatibility, the only "guarantee" that Ds design gives is that C code will either compile as D code with identical semantics o

newbie question

2011-09-19 Thread %u
does D compatibility with C restrict D from evolving ? and if D drop this will that prevent complexity?

Re: very newbie question (sring confusion)

2011-06-03 Thread Lloyd Dupont
std.algorithm! will have a look, thanks! "bearophile" wrote in message news:isb5ql$1i23$1...@digitalmars.com... Lloyd Dupont: I did the following, what do you think of my implementation? Those for loops seem better as foreach ones, or even reverse foreach ones. Probably in std.algorithm t

Re: very newbie question (sring confusion)

2011-06-03 Thread Jonathan M Davis
On 2011-06-03 09:55, Lloyd Dupont wrote: > I did the following, what do you think of my implementation? > (checking if my string and array usage could be improved / powered > up!!!) > > string[] _locales = ["en-AU", "fr-FR"]; > string getCurrentLocal() { return "fr-BE"; } > string[] getCandida

Re: very newbie question (sring confusion)

2011-06-03 Thread bearophile
Lloyd Dupont: > I did the following, what do you think of my implementation? Those for loops seem better as foreach ones, or even reverse foreach ones. Probably in std.algorithm there is stuff to shorten your code. Bye, bearophile

Re: very newbie question (sring confusion)

2011-06-03 Thread Lloyd Dupont
I did the following, what do you think of my implementation? (checking if my string and array usage could be improved / powered up!!!) string[] _locales = ["en-AU", "fr-FR"]; string getCurrentLocal() { return "fr-BE"; } string[] getCandidates() { auto local = getCurrentLocal(); strin

very newbie question (sring confusion)

2011-06-03 Thread Lloyd Dupont
maybe it's late, or I have a hard time reading the string and array class methods.. (which I have! :~) anyway, I have a very simple problem and it seems hard to fix! let say I have a list of resource named preferential order (favored first) and I'd like to do return a list of match in preferent

Re: Newbie question: COM programming and linking to Windows libraries

2009-03-12 Thread Sergey Gromov
Thu, 12 Mar 2009 17:12:41 -0400, Patrick Kristiansen wrote: > The compiler fails with the following error: > > setwallp.obj(setwallp) > Error 42: Symbol Undefined _coinitial...@4 > --- errorlevel 1 The implib doesn't produce acceptable results for Windows system DLLs. It does cre

Re: Newbie question: COM programming and linking to Windows libraries

2009-03-12 Thread Patrick Kristiansen
jicman Wrote: > Patrick Kristiansen Wrote: > > > Hi > > > > I've been trying out D lately, and I really love it. I use the Tango > > library at the moment, and I wanted to do some simple COM programming, > > which I'm also a newbie at, just to get more acquainted with Windows > > programming

Re: Newbie question: COM programming and linking to Windows libraries

2009-03-11 Thread jicman
Patrick Kristiansen Wrote: > Hi > > I've been trying out D lately, and I really love it. I use the Tango library > at the moment, and I wanted to do some simple COM programming, which I'm also > a newbie at, just to get more acquainted with Windows programming in D. > > What I want to do is re

Re: Newbie question: COM programming and linking to Windows libraries

2009-03-11 Thread Denis Koroskin
On Thu, 12 Mar 2009 00:31:33 +0300, Patrick Kristiansen wrote: Hi I've been trying out D lately, and I really love it. I use the Tango library at the moment, and I wanted to do some simple COM programming, which I'm also a newbie at, just to get more acquainted with Windows programming

Re: Newbie question: COM programming and linking to Windows libraries

2009-03-11 Thread Daniel Keep
Patrick Kristiansen wrote: > ... > > Now, this is probably obvious to some people - but not to me. Why doesn't > this work? Why does OPTLINK fail and tell me that the format of the .lib file > is wrong? Is it because Digital Mars compilers produce .lib files in a > different format? Is it bec

Re: Newbie question: COM programming and linking to Windows libraries

2009-03-11 Thread Jarrett Billingsley
On Wed, Mar 11, 2009 at 5:31 PM, Patrick Kristiansen wrote: > Apparently, one of the first things to do is call CoInitialize(...), and > this is where my problem arises. That's funny, I've never had to call it when using DirectX interfaces. Maybe it's something peculiar to DirectX? > CoInitia

Newbie question: COM programming and linking to Windows libraries

2009-03-11 Thread Patrick Kristiansen
Hi I've been trying out D lately, and I really love it. I use the Tango library at the moment, and I wanted to do some simple COM programming, which I'm also a newbie at, just to get more acquainted with Windows programming in D. What I want to do is relatively simple I think. I want to use the