Solved

Funny but true

Posted on 2004-09-10
24
442 Views
Last Modified: 2013-12-18
TestObject.CreateLogEntry("Hello World!")
TestObject.CreateLogEntryWithContext "Hello", " World!"

I wouldn't expect the first line to work, but it does. When I write the second line the same way it doesn't. Can anybody enlighten me as to why this might happen?

TestObject.CreateLogEntry("Hello World!")
TestObject.CreateLogEntryWithContext("Hello", " World!")

2nd line doesn't work. Says iliegal use of parenthesis. The first works.

And most funny -

TestObject.CreateLogEntryWithContext"Hello", " World!"

works too!!!!
0
Comment
Question by:RanjeetRain
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
24 Comments
 
LVL 19

Assisted Solution

by:madheeswar
madheeswar earned 30 total points
ID: 12025864
I am not sure about it.

Send your CV to may email Ranjeet.
Have a nice weekend
0
 
LVL 9

Assisted Solution

by:HappyFunBall
HappyFunBall earned 30 total points
ID: 12026925
I've seen this problem ever since I first started programming in Lotusscript.  If you use the 'Call' statement, that 2nd line will work:

Call TestObject.CreateLogEntry("Hello World!")
Call TestObject.CreateLogEntryWithContext("Hello", " World!")

Wish I could explain why this happens, but I just chalk it up with all the other idiosyncrasies in Domino.
0
 
LVL 46

Expert Comment

by:Sjef Bosman
ID: 12027124
Is not funny, Notes sucks!

Explanation:
either use
    Call name(param1, param2)
or
    name param1, param2

If you omit Call, then Notes assumes the second method. If it encounters a (, then it expects a parameter that is a valid expression. Now, (param1, param2) is NOT a valid expression in LS!

Be happy you found out like this, I have been staring at the following problem:

    Sub Sort(a As Variant) ' some Array
    ... 'results written back in a
    End Sub

I called the sub with
    Sort(array)
and the results were the original array. It took me HOURS to find out why.
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 19

Author Comment

by:RanjeetRain
ID: 12027441
LOL.... Funnunnyyyy Notesss

I know what you guys mean. But that's funny. I of course know the usage of the call statement and how it differs. But I was wondering how it could be acceptable. It didn't puzzle me if the 2nd line didn't work. I knew it was wrong usage, but first line working!!!!!!!! That sent me into tizzy :o)

I just came across this accidentally when I was doing some testing on parsing. Jeff, do you remember I was talking about LS parsing tool in one of my threads earlier? Oh, well! I am sorry! But, if this is how Notes behaves then I would rather invest my time on something else...  :-#
0
 
LVL 19

Author Comment

by:RanjeetRain
ID: 12027472
HFB.. you didn't get the funny side of it. See the line below:

TestObject.CreateLogEntry("Hello World!")

That should NOT work, should it? But it does :-/
0
 
LVL 46

Accepted Solution

by:
Sjef Bosman earned 90 total points
ID: 12027481
The difference between
    Dim a As Integer

    a= 4
   
    Sub1 a
    Sub2 (a)
    Call Sub3(a)
    Call Sub4((a))

is that the call to Sub2 is equivalent to the call to Sub4! The value a is passed by value, because of the parentheses!
0
 
LVL 19

Author Comment

by:RanjeetRain
ID: 12027609
Mady, I thought you changed job again. Is that true?

Ok, I have an offer for you. Come join my team. Interested?
0
 
LVL 46

Expert Comment

by:Sjef Bosman
ID: 12027625
Anyone need my CV?
0
 
LVL 19

Author Comment

by:RanjeetRain
ID: 12027631
Hmmm... thats interesting... lemme take a look at that :-B
0
 
LVL 19

Author Comment

by:RanjeetRain
ID: 12027666
LOL... want a salary in Rupees? You are welcome ;-) They say - heaven is when you have an American salary.... blah blah blah.... and an Indian wife.... hell is when you have an American wife... blah blah blah.... and an Indian salary.... LOL

But not that bad either... software guys make loads of money in India too :>
0
 
LVL 46

Expert Comment

by:Sjef Bosman
ID: 12027830
About your saying: that explains Partha's seventh heaven probably :D

> ... loads of money...

Is that literally? Truckloads of Rupee paper? What's the going rate against the US-Dollar? Or the Euro? And what's your offer I cannot refuse?
0
 
LVL 19

Author Comment

by:RanjeetRain
ID: 12028030
Partha's heaven... oh yeah ;)

Don't go for the going rate. It is long time before you can compare Rupee with Dollar or Euro :|

Offer would be - take it or leave it - My salary + 100K Rupees (Bonus for Non-indians)


0
 
LVL 46

Expert Comment

by:Sjef Bosman
ID: 12028216
100K bonus monthly or yearly? And I can stay here (for I have no intention to move)? Real Internet business? On a per project basis? Hmmm...
0
 
LVL 19

Author Comment

by:RanjeetRain
ID: 12028393
Sorry, we do not outsource... if you are willing to come here then only... yes you may get a chance in other offices of ours if the comapny "likes" you.
0
 
LVL 46

Expert Comment

by:Sjef Bosman
ID: 12028664
Development centres in US/India/Australia? No France? Sorry, I'll have to look around for a while...

Thanks for the offer!

By the way, happy with the explanation I gave? I can tell you that it was absolutely NOT funny at the time. When I finally found what was wrong, I could have kicked my own behind for being so stupid.
0
 
LVL 19

Author Comment

by:RanjeetRain
ID: 12028668
Oh I cracked it. Designer help long live :o)

(  )      (parentheses)

      (1) Groups an expression, controlling the order of evaluation of items in the expression.
      (2) Encloses an argument in a sub or function call that should be passed by value.
      (3) Encloses the argument list in function and sub definitions, and in calls to functions and subs.
      (4) Encloses the array bounds in array declarations, and the subscripts in references to array elements.
      (5) Encloses the list tag in a reference to a list element.



As per the rule #2, my first statement -- TestObject.CreateLogEntry("Hello World!") -- is legal. Why then the second one -- TestObject.CreateLogEntryWithContext("Hello", " World!") -- is not? The answer is, in the second statement LS compiler applies the rule #3.

So, the solution? The solution is to - enclose all the parameters in parenthesis separately. Now, that's nice isn't it!

TestObject.CreateLogEntryWithContext("Hello"), (" World!")    ' -- Works!!!




0
 
LVL 19

Author Comment

by:RanjeetRain
ID: 12028702
behind??? you mean to say b-u-t-t? ha ha ha... see you are increasing the work for CRAK ;-)

Btw, what did you finally find out :-#
0
 
LVL 19

Author Comment

by:RanjeetRain
ID: 12028730
We have no immediate plans of opening a center in Europe. C'mon you guys don't want Indian software professionals there, do you ;-)
0
 
LVL 46

Expert Comment

by:Sjef Bosman
ID: 12028754
You didn't see my post about a=4? It implies your rules. And I was talking about finding out why my Sort didn't work. Did you figure that one out by now?
0
 
LVL 19

Author Comment

by:RanjeetRain
ID: 12028828
I did notice your a=4. Though that didn't help me much. I read it and shrugged. Reading the rules made all the difference. I could immediately sort out my problem applying these rules ;-)

Nontheless points still go to you ;)
0
 
LVL 46

Expert Comment

by:Sjef Bosman
ID: 12029014
You're a friend :)

About my Sub Sort: sorting worked nicely, I could see that with the debugger. At the end of the sub, everything was in perfect order... and right after the return the unsorted array was still there. Rather annoying.

The way I called it using
    Sort(array)
was in fact equivalent to
    Call Sort((array))
so the array was passed by value to the sub. Which makes it immediately clear that, since the value of the array is passed to the sub, the local value will not be altered.
0
 
LVL 19

Author Comment

by:RanjeetRain
ID: 12029405
Okay then return my points.. LOL :))

Actually these are those subtle things that go unnoticed! Infact, in case of passing a variable it does make a difference. With Notes variables can be passed both by reference and by value (as long as called function can accept arguments passed by reference).  ANd ( and ) operator enforces that. Difficult to notice, isn't it :)

0
 
LVL 46

Expert Comment

by:Sjef Bosman
ID: 12029723
Let's call it a 'feature'...

Notes has more of those seldom-used or hard-to-see features, like the multi-declarations, e.g.
    Dim x, y As NotesDocument ' x=Variant!

Do you ever use
    Dim x List As String
in your code? There must be more, e.g. class-stuff, and Private, just to name a few.
0
 
LVL 19

Author Comment

by:RanjeetRain
ID: 12030471
Yeah right! And Dim x, y as String is a classic. I have seen even old programmers make this simple mistake. We can say old habbits die hard :)

LS syntax is a little too flexible at times. Probably that's because of the backward/forward  compatibilty that it must maintain with its predecessor languages.
0

Featured Post

Enroll in June's Course of the Month

June's Course of the Month is now available! Every 10 seconds, a consumer gets hit with ransomware. Refresh your knowledge of ransomware best practices by enrolling in this month's complimentary course for Premium Members, Team Accounts, and Qualified Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

For users on the Lotus Notes 8 Standard client, this article provides information on checking the Java Heap size and adjusting it to half of your system RAM in attempt to get the Lotus Notes 8.x Standard client to run faster.  I've had to exercise t…
Lack of Storage capacity is a common problem that exists in every field of life. Here we are taking the case of Lotus Notes Emails, as we all know that we are totally depend on e-communication i.e. Emails. This article is fully dedicated to resolvin…
There's a multitude of different network monitoring solutions out there, and you're probably wondering what makes NetCrunch so special. It's completely agentless, but does let you create an agent, if you desire. It offers powerful scalability …
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

696 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question