November 04, 2013 Re: [OT] Generating ddili.org with ddoc | ||||
---|---|---|---|---|
| ||||
Posted in reply to Philippe Sigaud | On 11/02/2013 01:34 AM, Philippe Sigaud wrote: > Any limitation you hit with Ddoc? One annoyance is with parentheses in code sections. Ddoc allows using ddoc macros even in code section and I like it because I can highlight parts of code by a macro. However, that means that unbalanced parentheses in code sections cause trouble. For example (if I remember correctly), even a string like "1) blah" in a code section causes formatting issues. So, one has to use the equivalents of the following macros: OPEN_PAREN = ( CLOSE_PAREN = ) COMMA = , DOLLAR = $ > if you could find the time to translate the turkish page, that would be > great! http://code.google.com/p/ddili/source/browse/trunk/README Ali |
November 04, 2013 Re: [OT] Generating ddili.org with ddoc | ||||
---|---|---|---|---|
| ||||
Posted in reply to Ali Çehreli Attachments:
| On Mon, Nov 4, 2013 at 6:05 AM, Ali Çehreli <acehreli@yahoo.com> wrote: > On 11/02/2013 01:34 AM, Philippe Sigaud wrote: > > > Any limitation you hit with Ddoc? > > One annoyance is with parentheses in code sections. Ddoc allows using ddoc macros even in code section and I like it because I can highlight parts of code by a macro. > Yeah, I saw that in your code. I didn't know that could be done. > However, that means that unbalanced parentheses in code sections cause trouble. For example (if I remember correctly), even a string like "1) blah" in a code section causes formatting issues. So, one has to use the equivalents of the following macros: > > OPEN_PAREN = ( > CLOSE_PAREN = ) > COMMA = , > DOLLAR = $ I saw these and wondered what they were for. Why comma and dollar? > > > if you could find the time to translate the turkish page, that would be great! > > http://code.google.com/p/ddili/source/browse/trunk/README > > Ah, thanks you, Ali. I now realize I got only a small part of it. |
November 04, 2013 Re: [OT] Generating ddili.org with ddoc | ||||
---|---|---|---|---|
| ||||
Posted in reply to Philippe Sigaud | On 11/03/2013 09:44 PM, Philippe Sigaud wrote: >> COMMA = , >> DOLLAR = $ > > > I saw these and wondered what they were for. Why comma and dollar? Actual comma inside a macro is taken as argument separator. From src/ders/d.en/operator_overloading.d: $(ROW3 slice to some elements, opSlice, collection[i$(VIRGUL) j]) (Note: VIRGUL is COMMA) If I used actual comma, " j]" would be taken as an unused extra parameter to ROW3. Dollar sign appears in dlang forum links. The only occurrence so far has been inside the Turkish translation of David Nadlinger's purity article, src/makale/saflik.d: $(LINK2 http://forum.dlang.org/thread/i7bp8o$(DOLAR)6po$(DOLAR)1@digitalmars.com, son değişikleri de getirmiş olan tartışma) Otherwise, the $ character would be parsed as the beginning of a macro. (Perhaps there is some sort of escaping but I just used the DOLAR macro. :-/) Ali |
November 06, 2013 Re: How to iterate using foreach on a class? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Nicolas Sicard | On Sunday, November 03, 2013 14:28:13 Nicolas Sicard wrote:
> > So we basically have 4 ways..?
> > 1) popFront + front
> > 2) opSlice
> > 3) alias this
> > 4) opApply
>
> How about having a nested struct implementing a range interface + a method (@property) returning it + alias this on the property?
>
> http://dpaste.dzfl.pl/230061d2
alias this should be avoided as much as possible. It's a bug magnet - especilaly when generic code is involved. And there's no reason to create a new range type in this case, because all that needs to be iterated over is the array. It makes by far the most sense to simply treat the class as a container, and overload opSlice so that it returns the array to be iterated over. If there was ever a need to do something more complicated than just iterate over the array, then a new range type could be returned from opSlice instead, but as it stands simply returning the array would be just fine.
- Jonathan M Davis
|
Copyright © 1999-2021 by the D Language Foundation