Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

"withCRs" problem
Hi
In VW 7.2, I'm trying to create a Dialog like this:

str := 'compilation error(s); see\' , lst , '\for details.\' withCRs.
Dialog warn: str.

"lst" is the name of a file. However, VW does not replace ALL
backslashes with CRs; in my case it leaves the first backslash (the one
after "see") as backslash. Why? What am I doing wrong? Or is it a bug?

Thanks for your help
Mike


Report this thread to moderator Post Follow-up to this message
Old Post
Michael Bielser
10-27-04 01:57 PM


Re: "withCRs" problem
I just found out (trial and error) a solution:

str := ('compilation error(s); see\',lst,'\for details.\') withCRs.
Dialog warn: str

However, it escapes me why I need parenthesis here; can anybody please
explain this?


Report this thread to moderator Post Follow-up to this message
Old Post
Michael Bielser
10-27-04 01:57 PM


Re: "withCRs" problem
You are only sending withCRs to the last string in your line of code. In
short I think you need a set of brackets so that withCRs is sent to the
final concatenated string i.e.
str := ('compilation error(s); see' , lst , '\for details.') withCRs

hth, Denis

Michael Bielser wrote:
> Hi
> In VW 7.2, I'm trying to create a Dialog like this:
>
> str := 'compilation error(s); see' , lst , '\for details.' withCRs.
> Dialog warn: str.
>
> "lst" is the name of a file. However, VW does not replace ALL
> backslashes with CRs; in my case it leaves the first backslash (the one
> after "see") as backslash. Why? What am I doing wrong? Or is it a bug?
>
> Thanks for your help
> Mike
>

Report this thread to moderator Post Follow-up to this message
Old Post
Denis Johnson
10-27-04 01:57 PM


Re: "withCRs" problem
Hi!

Michael Bielser wrote:

> str := ('compilation error(s); see',lst,'\for details.') withCRs.
> Dialog warn: str
>
> However, it escapes me why I need parenthesis here; can anybody please
> explain this?

The unary message "withCRs" will be evaluated before the binary message ",",
so your statement

str := 'compilation error(s); see',lst,'\for details.' withCRs.

would be evaluated as follows:

1.) '\for details.' withCRs.

2.) 'compilation error(s); see',lst  "no withCRs here"

3.) (result of 2) , (result of 1) "no withCRs here either"

4.) str := (result of 3)

So withCRs is a message sent to '\for details.' only...



Report this thread to moderator Post Follow-up to this message
Old Post
Michael Voss
10-27-04 01:57 PM


Re: "withCRs" problem
Denis Johnson wrote:

> str := ('compilation error(s); see' , lst , '\for details.') withCRs

But note that this will behave oddly if the filename contains back-slashes (
as
is common under Windows and legal, if rare, under Unix).

-- chris



Report this thread to moderator Post Follow-up to this message
Old Post
Chris Uppal
10-27-04 01:57 PM


Re: "withCRs" problem
"Chris Uppal" <chris.uppal@metagnostic.REMOVE-THIS.org> wrote in message
news:1pednTslOr8P6eLcRVn-uw@nildram.net...
> Denis Johnson wrote:
> 
>
> But note that this will behave oddly if the filename contains back-slashes
(as
> is common under Windows and legal, if rare, under Unix).
>
>     -- chris
>
>

I would rather put something like this together using a stream woth nextPut:
and nextPutAll:.
Also, instead of having it in the body of the message that uses it, I would
have a method called something like compilationExceptionString which answers
it.  Placing these in a protocol would make it easy to modify one or more
later, especially after those pesky Tech Writers get through with them.  :-)



Report this thread to moderator Post Follow-up to this message
Old Post
Can Altinbay
10-27-04 08:59 PM


Re: "withCRs" problem
Michael Bielser wrote:

> Hi
> In VW 7.2, I'm trying to create a Dialog like this:
>
> str := 'compilation error(s); see' , lst , '\for details.' withCRs.
> Dialog warn: str.
>
> "lst" is the name of a file. However, VW does not replace ALL
> backslashes with CRs; in my case it leaves the first backslash (the one
> after "see") as backslash. Why? What am I doing wrong? Or is it a bug?
>
> Thanks for your help
> Mike
>

Apart from the precedence issue others explained, in VW there is a
better way to do this:

Dialog warn: ('Compilation error(s); see<n><1s><n>for details.<n>'
expandMacrosWith: fileName)

See the comment to class StringParameterSubstitution for details on what
<...> thingies are allowed. This version does not have the problem with
backslashes in file names Chris Uppal pointed out.

And as a style point, if you catch yourself explaining that 'lst' is a
the name of a file, that means 'lst' is not a good name.

--
Vassili Bykov
Tools Technical Lead, VisualWorks Engineering
v b y k o v  A T  c i n c o m  D O T  c o m
http://www.cincomsmalltalk.com/userblogs/vbykov

Report this thread to moderator Post Follow-up to this message
Old Post
Vassili Bykov
10-27-04 08:59 PM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

Smalltalk archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 04:44 AM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.