June 14, 2009 Re: __FUNCTION__ implemented with mixins and mangles | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Jarrett Billingsley | Jarrett Billingsley wrote: > On Sun, Jun 14, 2009 at 9:31 AM, Denis Koroskin<2korden@gmail.com> wrote: >> On Sun, 14 Jun 2009 17:29:21 +0400, grauzone <none@example.net> wrote: >> >>> Jarrett Billingsley wrote: >>>> On Sat, Jun 13, 2009 at 9:46 PM, zsxxsz<zhengshuxin@hexun.com> wrote: >>>>> It's good. But I think it should be implement by the DMD compiler, just >>>>> like >>>>> __FILE__ and __LINE__. __FUNCTION__ should be the base D language >>>>> syntax same as >>>>> __FILE__, __LINE__, in C99, they're all the compiler's things to get >>>>> these and the >>>>> compiler do these more easily than any library. >>>>> >>>> I completely agree, but Walter and Andrei's argument against it is - >>>> where does it end? Do we need __PACKAGE__, __MODULE__, __TYPE__, >>>> __TEMPLATE__, etc. etc. etc.? And I agree with them too - but you >>> All we need is a __HERE__, which expands into a struct literal that >>> provides module, filename, etc. fields. It even can be linked to the next >>> enclosing scope to walk upwards nested functions and types. >>> >>> __FILE__ becomes __HERE__.filename, >>> __LINE__ becomes __HERE__.line >>> >> IIRC, it was previously proposed it as __SCOPE__ > > Oh, but I want it to be called __LOCATION__! No, __CONTEXT__! :P I think what he wanted to say is, it was proposed before and it was... ignored. > I really don't care WHAT it's called or what its semantics are. This > is a simple problem. This should not be hard to solve. Bah. Simple problems tend to be ignored. But because they don't go away themselves, they pile up and keep making life harder. | |||
June 15, 2009 Re: __FUNCTION__ implemented with mixins and mangles | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Jarrett Billingsley | == Quote from Jarrett Billingsley (jarrett.billingsley@gmail.com)'s article > On Sat, Jun 13, 2009 at 9:46 PM, zsxxsz<zhengshuxin@hexun.com> wrote: > > It's good. But I think it should be implement by the DMD compiler, just l > ike > > __FILE__ and __LINE__. __FUNCTION__ should be the base D language synt > ax same as > > __FILE__, __LINE__, in C99, they're all the compiler's things to get thes > e and the > > compiler do these more easily than any library. > > > I completely agree, but Walter and Andrei's argument against it is - where does it end? Do we need __PACKAGE__, __MODULE__, __TYPE__, __TEMPLATE__, etc. etc. etc.? And I agree with them too - but you know, it'd be nice to actually get some results on these things once in a while instead of a bunch of bullshit bikeshed discussions. Sheesh. What is the main use of __FILE__, __LINE__ and __FUNCTION__? Many people just use them for logging easily, including me. In some famous server such as Postfix, you may see 'const char *myname = "xxx"; ... msg_info("%s: xxx", myname);' in many files, it's a time cost for the programmer to do so. These are base requirments for D compiler. | |||
June 15, 2009 Re: __FUNCTION__ implemented with mixins and mangles | ||||
|---|---|---|---|---|
| ||||
Posted in reply to zsxxsz | zsxxsz escribió:
> == Quote from Jarrett Billingsley (jarrett.billingsley@gmail.com)'s article
>> On Sat, Jun 13, 2009 at 9:46 PM, zsxxsz<zhengshuxin@hexun.com> wrote:
>>> It's good. But I think it should be implement by the DMD compiler, just l
>> ike
>>> __FILE__ and __LINE__. __FUNCTION__ should be the base D language synt
>> ax same as
>>> __FILE__, __LINE__, in C99, they're all the compiler's things to get thes
>> e and the
>>> compiler do these more easily than any library.
>>>
>> I completely agree, but Walter and Andrei's argument against it is -
>> where does it end? Do we need __PACKAGE__, __MODULE__, __TYPE__,
>> __TEMPLATE__, etc. etc. etc.? And I agree with them too - but you
>> know, it'd be nice to actually get some results on these things once
>> in a while instead of a bunch of bullshit bikeshed discussions.
>> Sheesh.
>
> What is the main use of __FILE__, __LINE__ and __FUNCTION__? Many people just use
> them for logging easily, including me. In some famous server such as Postfix, you
> may see 'const char *myname = "xxx"; ... msg_info("%s: xxx", myname);' in many
> files, it's a time cost for the programmer to do so. These are base requirments
> for D compiler.
I never had to use them in other languages. Why? Because debugging support in them is excelent. So maybe enhancing debugging support for D is better than adding a couple of keywords just to make *printf debugging* better.
| |||
June 15, 2009 Re: __FUNCTION__ implemented with mixins and mangles | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Ary Borenszweig | "Ary Borenszweig" <ary@esperanto.org.ar> wrote in message news:h149vq$21ku$1@digitalmars.com... > zsxxsz escribió: >> == Quote from Jarrett Billingsley (jarrett.billingsley@gmail.com)'s article >>> On Sat, Jun 13, 2009 at 9:46 PM, zsxxsz<zhengshuxin@hexun.com> wrote: >>>> It's good. But I think it should be implement by the DMD compiler, just l >>> ike >>>> __FILE__ and __LINE__. __FUNCTION__ should be the base D language synt >>> ax same as >>>> __FILE__, __LINE__, in C99, they're all the compiler's things to get thes >>> e and the >>>> compiler do these more easily than any library. >>>> >>> I completely agree, but Walter and Andrei's argument against it is - where does it end? Do we need __PACKAGE__, __MODULE__, __TYPE__, __TEMPLATE__, etc. etc. etc.? And I agree with them too - but you know, it'd be nice to actually get some results on these things once in a while instead of a bunch of bullshit bikeshed discussions. Sheesh. >> >> What is the main use of __FILE__, __LINE__ and __FUNCTION__? Many people >> just use >> them for logging easily, including me. In some famous server such as >> Postfix, you >> may see 'const char *myname = "xxx"; ... msg_info("%s: xxx", myname);' in >> many >> files, it's a time cost for the programmer to do so. These are base >> requirments >> for D compiler. > > I never had to use them in other languages. Why? Because debugging support in them is excelent. So maybe enhancing debugging support for D is better than adding a couple of keywords just to make *printf debugging* better. Great, now try to take that language with great debugging support, and use it to do the same wonderful debugging on a *platform* that doesn't have excellent debugging support. Not everyone writes desktop apps. Besides, there's been plenty of times I've solved a problem using __blah__ and printf debugging in less time than it would have taken to fire up the debugger. And as for __FUNCTION__, that's useful for DRY. | |||
June 15, 2009 Re: __FUNCTION__ implemented with mixins and mangles | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Nick Sabalausky | Hello Nick,
> "Ary Borenszweig" <ary@esperanto.org.ar> wrote in message
> news:h149vq$21ku$1@digitalmars.com...
>
>> zsxxsz escribió:
>>
>> I never had to use them in other languages. Why? Because debugging
>> support in them is excelent. So maybe enhancing debugging support for
>> D is better than adding a couple of keywords just to make *printf
>> debugging* better.
>>
> Great, now try to take that language with great debugging support, and
> use it to do the same wonderful debugging on a *platform* that doesn't
> have excellent debugging support. Not everyone writes desktop apps.
> Besides, there's been plenty of times I've solved a problem using
> __blah__ and printf debugging in less time than it would have taken to
> fire up the debugger. And as for __FUNCTION__, that's useful for DRY.
>
I've fixed a number of bugs with "fprintf" and a diff tool that I /still/ don't care to consider doing with just a debugger. And that's in C# under VS with one of the best debuggers ever written.
| |||
June 15, 2009 Re: __FUNCTION__ implemented with mixins and mangles | ||||
|---|---|---|---|---|
| ||||
Posted in reply to BCS | 在 Mon, 15 Jun 2009 12:43:55 +0800,BCS <none@anon.com> 写道: > Hello Nick, > >> "Ary Borenszweig" <ary@esperanto.org.ar> wrote in message >> news:h149vq$21ku$1@digitalmars.com... >> >>> zsxxsz escribió: >>> I never had to use them in other languages. Why? Because debugging >>> support in them is excelent. So maybe enhancing debugging support for >>> D is better than adding a couple of keywords just to make *printf >>> debugging* better. >>> >> Great, now try to take that language with great debugging support, and >> use it to do the same wonderful debugging on a *platform* that doesn't >> have excellent debugging support. Not everyone writes desktop apps. >> Besides, there's been plenty of times I've solved a problem using >> __blah__ and printf debugging in less time than it would have taken to >> fire up the debugger. And as for __FUNCTION__, that's useful for DRY. >> > > I've fixed a number of bugs with "fprintf" and a diff tool that I /still/ don't care to consider doing with just a debugger. And that's in C# under VS with one of the best debuggers ever written. However, you can understand how code runs much easier with a debugger rather than just read the source. For me, a debugger provides an easier way to understand code written by others. -- 使用 Opera 革命性的电子邮件客户程序: http://www.opera.com/mail/ | |||
June 15, 2009 Re: __FUNCTION__ implemented with mixins and mangles | ||||
|---|---|---|---|---|
| ||||
Posted in reply to davidl | Hello davidl,
> ÔÚ Mon, 15 Jun 2009 12:43:55 +0800£¬BCS <none@anon.com> дµÀ:
>
>> I've fixed a number of bugs with "fprintf" and a diff tool that I
>> /still/ don't care to consider doing with just a debugger. And that's
>> in C# under VS with one of the best debuggers ever written.
>>
> However, you can understand how code runs much easier with a debugger
> rather than just read the source. For me, a debugger provides an
> easier way to understand code written by others.
>
most of the time the debugger is the tool for the job, some of the time, just give me __FILE__, __LINE__, printf and a club!
| |||
June 15, 2009 Re: __FUNCTION__ implemented with mixins and mangles | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Ary Borenszweig | Ary Borenszweig wrote:
> zsxxsz escribió:
>> == Quote from Jarrett Billingsley (jarrett.billingsley@gmail.com)'s article
>>> On Sat, Jun 13, 2009 at 9:46 PM, zsxxsz<zhengshuxin@hexun.com> wrote:
>>>> It's good. But I think it should be implement by the DMD compiler, just l
>>> ike
>>>> __FILE__ and __LINE__. __FUNCTION__ should be the base D language synt
>>> ax same as
>>>> __FILE__, __LINE__, in C99, they're all the compiler's things to get thes
>>> e and the
>>>> compiler do these more easily than any library.
>>>>
>>> I completely agree, but Walter and Andrei's argument against it is -
>>> where does it end? Do we need __PACKAGE__, __MODULE__, __TYPE__,
>>> __TEMPLATE__, etc. etc. etc.? And I agree with them too - but you
>>> know, it'd be nice to actually get some results on these things once
>>> in a while instead of a bunch of bullshit bikeshed discussions.
>>> Sheesh.
>>
>> What is the main use of __FILE__, __LINE__ and __FUNCTION__? Many people just use
>> them for logging easily, including me. In some famous server such as Postfix, you
>> may see 'const char *myname = "xxx"; ... msg_info("%s: xxx", myname);' in many
>> files, it's a time cost for the programmer to do so. These are base requirments
>> for D compiler.
>
> I never had to use them in other languages. Why? Because debugging support in them is excelent. So maybe enhancing debugging support for D is better than adding a couple of keywords just to make *printf debugging* better.
__FILE__, __LINE__, __FUNCTION__, etc. are more often used for *logging* than for debugging. Of course, ideally, the logger would be able to identify all this stuff on its own (i.e. from a stack trace), but in a compiled language this is pretty tricky (impossible on Windows without debug symbols).
| |||
June 15, 2009 Re: __FUNCTION__ implemented with mixins and mangles | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Robert Fraser | == Quote from Robert Fraser (fraserofthenight@gmail.com)'s article
> Ary Borenszweig wrote:
> > zsxxsz escribió:
> >> == Quote from Jarrett Billingsley (jarrett.billingsley@gmail.com)'s
> >> article
> >>> On Sat, Jun 13, 2009 at 9:46 PM, zsxxsz<zhengshuxin@hexun.com> wrote:
> >>>> It's good. But I think it should be implement by the DMD compiler, just l
> >>> ike
> >>>> __FILE__ and __LINE__. __FUNCTION__ should be the base D language synt
> >>> ax same as
> >>>> __FILE__, __LINE__, in C99, they're all the compiler's things to get thes
> >>> e and the
> >>>> compiler do these more easily than any library.
> >>>>
> >>> I completely agree, but Walter and Andrei's argument against it is - where does it end? Do we need __PACKAGE__, __MODULE__, __TYPE__, __TEMPLATE__, etc. etc. etc.? And I agree with them too - but you know, it'd be nice to actually get some results on these things once in a while instead of a bunch of bullshit bikeshed discussions. Sheesh.
> >>
> >> What is the main use of __FILE__, __LINE__ and __FUNCTION__? Many
> >> people just use
> >> them for logging easily, including me. In some famous server such as
> >> Postfix, you
> >> may see 'const char *myname = "xxx"; ... msg_info("%s: xxx", myname);'
> >> in many
> >> files, it's a time cost for the programmer to do so. These are base
> >> requirments
> >> for D compiler.
> >
> > I never had to use them in other languages. Why? Because debugging support in them is excelent. So maybe enhancing debugging support for D is better than adding a couple of keywords just to make *printf debugging* better.
> __FILE__, __LINE__, __FUNCTION__, etc. are more often used for *logging* than for debugging. Of course, ideally, the logger would be able to identify all this stuff on its own (i.e. from a stack trace), but in a compiled language this is pretty tricky (impossible on Windows without debug symbols).
Yes, I agree with it.
| |||
June 15, 2009 Re: __FUNCTION__ implemented with mixins and mangles | ||||
|---|---|---|---|---|
| ||||
Posted in reply to zsxxsz | zsxxsz Wrote:
> == Quote from Robert Fraser (fraserofthenight@gmail.com)'s article
> > Ary Borenszweig wrote:
> > > zsxxsz escribió:
> > >> == Quote from Jarrett Billingsley (jarrett.billingsley@gmail.com)'s
> > >> article
> > >>> On Sat, Jun 13, 2009 at 9:46 PM, zsxxsz<zhengshuxin@hexun.com> wrote:
> > >>>> It's good. But I think it should be implement by the DMD compiler, just l
> > >>> ike
> > >>>> __FILE__ and __LINE__. __FUNCTION__ should be the base D language synt
> > >>> ax same as
> > >>>> __FILE__, __LINE__, in C99, they're all the compiler's things to get thes
> > >>> e and the
> > >>>> compiler do these more easily than any library.
> > >>>>
> > >>> I completely agree, but Walter and Andrei's argument against it is - where does it end? Do we need __PACKAGE__, __MODULE__, __TYPE__, __TEMPLATE__, etc. etc. etc.? And I agree with them too - but you know, it'd be nice to actually get some results on these things once in a while instead of a bunch of bullshit bikeshed discussions. Sheesh.
> > >>
> > >> What is the main use of __FILE__, __LINE__ and __FUNCTION__? Many
> > >> people just use
> > >> them for logging easily, including me. In some famous server such as
> > >> Postfix, you
> > >> may see 'const char *myname = "xxx"; ... msg_info("%s: xxx", myname);'
> > >> in many
> > >> files, it's a time cost for the programmer to do so. These are base
> > >> requirments
> > >> for D compiler.
> > >
> > > I never had to use them in other languages. Why? Because debugging support in them is excelent. So maybe enhancing debugging support for D is better than adding a couple of keywords just to make *printf debugging* better.
> > __FILE__, __LINE__, __FUNCTION__, etc. are more often used for *logging* than for debugging. Of course, ideally, the logger would be able to identify all this stuff on its own (i.e. from a stack trace), but in a compiled language this is pretty tricky (impossible on Windows without debug symbols).
>
> Yes, I agree with it.
Perhaps not the first thing to think off, but what about webservices for example? They could use such a system. Though it should be more elaborate than just the function name. If you could do this with all scopes, it would be trivial to expose them.
| |||
Copyright © 1999-2021 by the D Language Foundation
Permalink
Reply