THEY HAVE ALWAYS BEEN VARADIC.

I have made them so they will also work for people who refuse to read  
the documentation and assume that they have the same interface as  
Debug.write.

On 2006-04-21, at 15:33 EDT, Benjamin Shine wrote:

>
> So you've made Debug.warn and Debug.error variadic? Great!
>
> On Apr 21, 2006, at 12:27 PM, P T Withington wrote:
>
>> Since no one commented, I implemented this (for legals), to see how
>> it works.  If there is popular demand, it could be migrated to 3.x.
>>
>> The underlying implementation of Debug.format now detects the case of
>> the 'control' string either not being a string, or there being
>> multiple arguments and no format directives in the control string.
>> In either of those cases, it will simply emit each of the arguments
>> separated by spaces.
>>
>> If there is a control string with format directives, it will warn if
>> the number of arguments does not match the number of directives.
>>
>> On 2006-04-19, at 12:14 EDT, P T Withington wrote:
>>
>>> The debugger has always had a method Debug.write that can be used
>>> to output to the debugger console.  It takes any number of
>>> arguments and outputs them, separated by spaces.  It uses the
>>> Debug.__String method to present objects, which makes them
>>> 'inspectable' in the output window (you can click on them to invoke
>>> Debug.inspect on the object).
>>>
>>> In 3.2 (and perhaps earlier) there is a new method, Debug.format,
>>> that acts more like printf.  It takes a 'control' string, and any
>>> number of arguments and formats the arguments according to the
>>> format directives in the control string.  For the most part it
>>> supports the same directives as printf, but there is an additional
>>> one, %w, which outputs the argument as if it were printed by
>>> Debug.write, thus making it inspectable.  [In the Legal's branch,
>>> objects that are formatted by %s are also inspectable, but their
>>> presentation is as if they were printed by toString.]
>>>
>>> Debug.warn and Debug.error take arguments like Debug.format and
>>> create warnings or error messages on the debugger console.  They
>>> are labeled with a tag (WARNING: or ERROR:) and presented in orange
>>> or red.  They have the additional feature that if backtracing is
>>> enabled, they capture a backtrace, which can be seen by inspecting
>>> (clicking on) the message.
>>>
>>> In recent weeks I have had several bug reports that Debug.warn and
>>> Debug.error do not work.  Apparently this is because the caller
>>> expected them to be like Debug.write and simply take a list of
>>> arguments that are output separated by spaces.  What they see is
>>> only their first argument being printed (because it is interpreted
>>> as a control string with no format directives).
>>>
>>> It occurred to me today that I could have them check for the case
>>> of multiple arguments with no format controls in the first argument
>>> and operate in 'Debug.write compatibility mode' if that is the
>>> case.  Would this be useful?  Too complex to document?  Are there
>>> pitfalls?  Is there a use case where ignoring the extra arguments
>>> is really what is desired?
>>>
>>> Your comments solicited.
>>
>> _______________________________________________
>> Laszlo-dev mailing list
>> [email protected]
>> http://www.openlaszlo.org/mailman/listinfo/laszlo-dev
>
> _______________________________________________
> Laszlo-dev mailing list
> [email protected]
> http://www.openlaszlo.org/mailman/listinfo/laszlo-dev

_______________________________________________
Laszlo-dev mailing list
[email protected]
http://www.openlaszlo.org/mailman/listinfo/laszlo-dev

Reply via email to