How Well Do You Know LotusScript?

The danger in LotusScript is when you spend time in other "proper" languages and then return to LotusScript, foolishly thinking you can use what you use elsewhere.

Take this as an example:

Dim i As Integer

For i = 1 to 2

   Dim isIAnOddNumber As Boolean 'Defaults to False!
   If i Mod 2 = 1 Then
       isIAnOddNumber = True
   End If

   Print isIAnOddNumber

What would you expect the output to be?


    • avatar
    • Brian Miller
    • Wed 30 Jan 2013 03:03 PM

    That should result in an error. You can only Dim a variable once, trying it again raises an error.

    I lobbied pretty hard for a refresh of LotusScript generally, to include all the things that other languages had introduced. But, there was absolutely no interest from IBM on the subject. The general opinion was that people should move away from LotusScript as much as possible.

      • avatar
      • Jake Howlett
      • Wed 30 Jan 2013 03:26 PM

      No errors. Just an unexpected result (for me at least) from the two Print statements.

      You can tell they've given up on Lotuscript. The editor is shockingly bad. Comically so. Well, I laugh. If I didn't...

      Show the rest of this thread

  1. My guess would be True and True, when it should have been True and False.

      • avatar
      • Jake Howlett
      • Wed 30 Jan 2013 04:31 PM

      Correct. Don't you just love LotusScript! I discovered this at considerable damage to the reputation I've managed to build with a client. My fault for not testing more thoroughly, but come on...

      Show the rest of this thread

  2. Quit trying to sell customers programs written in BASIC. You might as well be sending them documentation written with crayons.

      • avatar
      • Jake Howlett
      • Thu 31 Jan 2013 01:38 AM

      I had no choice of the use of Lotusscript

    1. If this post didn't have the three bold famous letters in its header, I would have suspected it to be your regular troll's take on it. There are so many other things you can do wrong in the more commonly used programming languages C, Java, Objective-C, C++, C# ...

      Not to mention JavaScript (considered to be the "dark horses for 2013" regarding popularity by tiobe.com), sharing about all the weaknesses of LotusScript.

      And Jake, relying on the declaration to restore the default value is not the most robust approach (obviously ...), nor the most readable. I know that (just like me) you love short code. But in this case it's a matter of typing 20 additional characters for a working version (less, if the variable name wasn't that damn long). ;-)

      • avatar
      • Jeroen Jacobs
      • Thu 31 Jan 2013 03:42 AM

      What's the alternative then? I don't know how the situation is today, but about a year ago the rendering of XPages applications in the Lotus Notes client was terribly slow and unstable.

      Show the rest of this thread

    2. Depends on how you look at it. The customer should be buying solutions that solve their business problems.

      And given what I've seen presented as "documentation", in many cases, crayon would be far better.

    3. Looks like that red pill made your head swell even more.

    4. That was both insightful and helpful. Thank you for your contribution to the conversation. Eloquent as ever, Nathan.

  3. And then there are the idiosyncrazies in the product objects. Like NotesDocumentCollection not being a collectuion you can use with ForAll.

    Or NotesDocumentCollection.Merge working so poorly it is unusable. The documentation for the method reveals a level of inattention which is atrocious.

    Still love it, but these pitfalls distract from the beauty.

  4. Jake, I am pretty sure the result is True, True which is exactly as it would be expected. LotusScript has never supported scoping variables to a block of code it has only ever been at the code module level itself. For this reason I never liked to see programs written in which Dim statements were placed anywhere else other then at the very top of the code module as it could lead the inexperienced LotusScript developer to assume placement had an effect.

    As to the side conversation of IBM no longer supporting the language. This has been the way of the world for quite a long time now and will not change. Get over it and move on. Learn what the language does and exploit it within its current limitations. In its day it was an awesome language combined with the power of the Notes client. Probably more applications have been developed using this language than any other. It did its job, but its not the future. The flat earth society still meets in London on a regular basis but I am pretty sure they don't take themselves too seriously.

    • avatar
    • Rami Jundi
    • Thu 31 Jan 2013 10:30 AM

    My take, not great practice to dim variables (esp objects) inside a loop you are reusing?

      • avatar
      • Jake Howlett
      • Thu 31 Jan 2013 11:10 AM

      In all languages or just lotus script?

      Show the rest of this thread

      • avatar
      • Christian Zalto
      • Thu 31 Jan 2013 02:01 PM

      Full ACK. It's just bad coding style, not a problem with the Lotusscript language.

      Show the rest of this thread

    • avatar
    • richard fenwick
    • Thu 31 Jan 2013 11:28 AM

    Who says the earth is not flat?

  5. 1. Declaring variables as close (in terms of scope as well as lines of code) to where they're going to be used is excellent practice. The compiler may just end up declaring them all at the top in the code, but it means that us humans dealing with the variables only have to visually eyeball the code from the declaration point onwards.

    2. Lotuscript scope works just fine. This is a bug - in that the compiler has 'optimised' this by pulling the declaration out of the loop (and therefore the scope) and so the variable is only initialised once, instead of on each loop as we'd expect.

    So yes. variables DIMmed inside loops need explicit initial values.

    Its not good, but its well known. Sorry it's bitten you in the backside.

    3. Lotuscript - the language - has not been updated since v4.6 (they started returning a variant from 'execute' instead of a single line string).

    The domino back end objects have all been incremented on each release. For instance, now, in v9, we actually have a fully-functional calendar API. At last.

    4. Lotuscript is old

    Yes, very old. Still supported, still a partially compiled P-code language, and still platform independent. So if you have a notes environment, then you can still get it to do significant things.

    Yes, the XPages guys like to call it 'Legacy' but because its underpinning all these apps that keep our Domino installations running, it still has enormous value.


    ---* Bill

    1. @Bill - are you sure it hasn't been updated since V 4.6? I know they have extended it with almost every major release and in some versions signatures have changed (printing, for example, gained the ability to specify the printer to use with release 7 or 8) and other little things.

      Maybe you mean the compiler hasn't been significantly updated? Certainly seems to be the case. Would have been keen to see it keep up with VB.

      Especially agree with #4 :-) I won't be sweeping it off the resume anytime soon.

      • avatar
      • Jake Howlett
      • Sat 2 Feb 2013 12:06 PM

      Thanks Bill. I feel slightly less of a dufus now.

    2. That's not a bug. The compiler didn't optimize anything. It's how the language is supposed to work. It comes from the way that ANSI BASIC, which LotusScript was based on, defined the scope rules. According to the rules of the language, you can dim anywhere but the scope is always the containing function or sub, or the module if the declaration is not within a function or a sub. An interpreter is free to delay allocating the storage until it first encounters the dim, but it's not free to destroy and reallocate the storage each time it encounters the dim. This is why you need to use redim if you want to change bounds for an array, instead of just another dim. You can get localized scope for objects by using the New and Delete operators, but even that is not actually defining local scope for the variable that happens to contain the object reference.

  6. Yup. The language itself, the compiler and the code it generates - is still lotusscript v2.6 - last updated in v4.6.

    The domino object backend has been updated on almost every release.

    It'll never be updated - thats been confirmed.

    ---* Bill

  7. I went on


    and this came up

    Very sorry for the delay in re-opening membership. I've cast a new batch of membership medallions and will have membership open again by the start of December!

    and there is


    perhaps the land fill to end all land fills?

    1. Wouldnt matter to the EU - they would still charge us a fortune to fill it!

Your Comments


About This Page

Written by Jake Howlett on Wed 30 Jan 2013

Share This Page

# ( ) '


The most recent comments added:

Skip to the comments or add your own.

You can subscribe to an individual RSS feed of comments on this entry.

Let's Get Social

About This Website

CodeStore is all about web development. Concentrating on Lotus Domino, ASP.NET, Flex, SharePoint and all things internet.

Your host is Jake Howlett who runs his own web development company called Rockall Design and is always on the lookout for new and interesting work to do.

You can find me on Twitter and on Linked In.

Read more about this site »

More Content