• (cs) in reply to James Schend
    Anonymous:
    Nobody likes Notes, except grizzled old Notes programmers, and its function is replaced MUCH better (and MUCH cheaper) by Microsoft Exchange/Outlook and Access.  (And I know, Access sucks, but compared to Notes it's heaven-sent.)

    My theory is that IBM sells Notes via hypnosis.


    Notes is more than email. Very useful when creating workflow type applications.
  • (cs) in reply to Rui
    Rui:
    Xepol:
    I dunno, looks like a bad language to me. That @If operator alone should inspire a mob and a bonfire.


    I've got the bonfire burning ...
    Let's get'em !!!


    By the way, I would love to know if there is a @Switch operator with the ingenious syntax of @If  ... now that would be amazing ( to further obfuscate code )

    __
    Rui


    You don't need a @Switch operator.
    @If works with multiple conditions (up to 99) without nesting
    @If( condition1 ; action1 ; condition2 ; action2 ; ... ; condition99 ; action99 ; else_action )
  • Anonymous (unregistered) in reply to haveworld
    Anonymous:
    Nobody likes Notes, except grizzled old Notes programmers, and its function is replaced MUCH better (and MUCH cheaper) by Microsoft Exchange/Outlook and Access.  (And I know, Access sucks, but compared to Notes it's heaven-sent.)

    My theory is that IBM sells Notes via hypnosis.

    ROTFL, have you sent your letter to Santa yet?

    Notes is so old, most of you weren't even around yet. And it's a platform, not a programming language. And what you see here is it's oldest programming thingy (note: not language), called formula language, taken straight from Lotus 1-2-3 some 20 years ago and put into Notes (also some 20 years ago). And they kept it in there for compatibility reasons, only they added LotusScript (VB-Clone) and Java a while back. And trust me, the WTF is not the formula lang, it's the so called programmer.

  • (cs)

    Don't blame the language...WTF like this could be done in many other languages as this forum has shown time and time again.

  • (cs) in reply to dhromed
    dhromed:
    A language where formatting is significant is an unnecessarily restrictive language. Whitespace should never impact program logic. It's dumb.

    Not any dumber that using braces for that matter.

    Look at it that way: everyone indents code. Not indenting code is not only stupid, but annoying.

    Indentation is defined via block structures, braces and the like therefore become redundant with indentation.

    That's how Guido saw it, and that's how many Pythonistas see it. Now if you don't like it you don't have to use python

    Zlodo:
    Yeah. Instead, python gives you endless hours of fun when your indention settings doesn't matches the settings of the guy who originally wrote the script that you're modifying.

    God, seriously, not only is converting space to tabs and tabs to space trivial but tools like Pylint or Pychecker can take care of the automated validation of your indentation levels for you...

    Zlodo:
    It also gets hard to read very quickly because the blocks aren't visible quite as easily without braces.

    Uh... right... I realize that it'll probably hurts your feelings but everyone who's used Python for more than a day thinks you're wrong.

    Zlodo:
    Also, a simple indention error change the behavior of the code.

    yes and? A brace error can change the behavior of the code as well, and an indentation error in whitespace-insignificant languages can very well change the meaning of the code (to the programmer), making debugging a damn pain.

  • Dan Pope (unregistered) in reply to Zlodo
    Zlodo:

    Yeah. Instead, python gives you endless hours of fun when your indention settings doesn't matches the settings of the guy who originally wrote the script that you're modifying.


    Only if you mix tabs with spaces. Besides, in Python tabs stops are assumed to be at intervals of 8 spaces, so it's not as if there isn't a right and a wrong setting.

    Zlodo:

    It also gets hard to read very quickly because the blocks aren't visible quite as easily without braces.


    I disagree. Intendation guarantees that block are visibly rectangular: they start and finish on a line break, and the statements within the block start at the same column on a line.

    In fact a lot of obfuscated C code takes advantage of the illegibility of brace-delimited blocks.

    Zlodo:

    Also, a simple indention error change the behavior of the code.


    Just like a simple brace error in languages which rely on braces.
  • (cs) in reply to ammoQ
    ammoQ:
    dhromed:

    A language where formatting is significant is an unnecessarily restrictive language. Whitespace should never impact program logic. It's dumb.


    It always does, if you count linefeed as whitespace.


    Ignoring the preprocessor, AFAIK one could write C/C++ program completely in one line

    (altough if you're paid by the line this would be rather dumb ...)
  • (cs) in reply to Dan Pope
    Anonymous:

    Zlodo:

    Also, a simple indention error change the behavior of the code.

    Just like a simple brace error in languages which rely on braces.


    Not true.  I like python, but indentation errors are harder than brace errors.

    In languages with braces, if there is a brace error your compiler catches it right away, and you add the missing brace and you are good to go.  

    In Python the same error means you have to go through the entire code to decide what needs to be reindented.

    Often I have had code like:

    if foo:
      bar():
    else:
       baz()

    Then when I realize that the whole thing needs to be in a check, and my re-indent ends up as

    if blah:
      if foo:
        bar()
    else:
      baz()

    Note that else case should have been indented to line up with the if foo, but I didn't do the indent right (every editor I've used will not help here).    In complex code this can be a big problem.   It gets worse if blah and foo are both expected to be true 99% of the time, when the unit test fails weeks latter I'm not longer sure how to code works so I have to look closely.    The deeper you nest things the worse it is.   (Though I agree deeply nesting is bad)

    The difference is slight, but the advantage is to braces.  I have not had this type of problem.

  • (cs) in reply to Rui
    Rui:
    ammoQ:
    dhromed:

    A language where formatting is significant is an unnecessarily restrictive language. Whitespace should never impact program logic. It's dumb.


    It always does, if you count linefeed as whitespace.


    Ignoring the preprocessor, AFAIK one could write C/C++ program completely in one line

    (altough if you're paid by the line this would be rather dumb ...)


    It's rather difficult (though not impossible) to write a C/C++ program without the preprocessor; and even without the preprocessor,
    the // style comments also rely on linefeeds.


  • (cs) in reply to ammoQ
    ammoQ:
    dhromed:

    A language where formatting is significant is an unnecessarily restrictive language. Whitespace should never impact program logic. It's dumb.


    It always does, if you count linefeed as whitespace.

    Not at all, most languages use a semi-colon as an end of line marker. This has the advantage of allowing you to have one line of code spanning several lines to prevent it becoming unreadable.

  • (cs) in reply to Sean
    Anonymous:

    Anonymous:
    Nobody likes Notes, except grizzled old Notes programmers, and its function is replaced MUCH better (and MUCH cheaper) by Microsoft Exchange/Outlook and Access.  (And I know, Access sucks, but compared to Notes it's heaven-sent.)

    My theory is that IBM sells Notes via hypnosis.

    I can tell that you get truck loads of Redmond Kool-aid sent you in convenient IV drip bags.  Only someone who lives and breathes the Northwest air and has never actually looked under the hood of a large Notes deployment would make a comment as ridiculous as you just did.  The day you can build ANY REAL application in Exchange and acccess it via Outlook will be the day that Ray Ozzie is working at running MS.  And considering they are both built on the ancient Jet engine technology says enough about their ability to scale to the enterprise.

    Anyways, for those of you who look at the code above and go "You call that a programming language?", think of the @Formula language in Notes the same way you think of the macro language Excel.  It was built to let power users do some advanced things without having to call the IT department.  Unfortunately, it also allowed some non-geeks to write some truly horrid functions.  But at least it gives some of us a laugh or tw now and then.  I can't imagine the time it took to write this function when it could be replaced by just the name of a field.

    My theory is the MS sells Exchange by simply bribing the IT upper management.  Who needs hypnosis when you can just buy them off.



    You both are cracked.  Flaming each other over which is better Notes vs. Outlook/Exchange is like say which pile of sh*t tastes better, one with corn kernels or one with peanuts!
  • (cs) in reply to ammoQ

    True, but you always have /c comments/
    And as for C++, i wouldn't be too surprised if sometime in the near future a language equivalent of #include was introduced to the language.

    something like
    using "filename.hpp";

  • jbode (unregistered) in reply to masklinn
    masklinn:
    Zlodo:
    Also, a simple indention error change the behavior of the code.

    yes and? A brace error can change the behavior of the code as well, and an indentation error in whitespace-insignificant languages can very well change the meaning of the code (to the programmer), making debugging a damn pain.

    Difference being, having a visible delimiter such as a brace or keyword makes it a little easier (for me, anyway) to find the mismatch by inspection. 

    As far as Notes goes, I had to womp up a simple script to grab statistics from a defect database using the Formula language thingy.  Not an experience I'm anxious to repeat.   Of course, Notes in general isn't an experience I'm anxious to repeat.  They All Suck, but Notes sucks just a hair worse. 

  • (cs) in reply to ammoQ

    It's been said already but... NO. In any of the C languages, linefeeds do not impact program logic, except for the // comment. This is one of the reasons I mainly use /* */. I think having whitespace, tabs, or linefeeds control program logic is a very bad idea for any language. Not all operating systems even have the same definition for the end of a line (crlf vs lf). The fact that a tab represents a large space just makes it difficult in a monospace world of code. Python is a great language, but for these reasons I have yet to actually use it. So sue me if I want my code too look like:

    Image.ReplaceColors(
                        ((System.Drawing.Color)arguments[0]),
                        ((System.Drawing.Color)arguments[1]),
                        ((System.Drawing.Color)arguments[2]));


  • (cs) in reply to James Schend

    Anonymous:
    I can tell that you get truck loads of Redmond Kool-aid sent you in convenient IV drip bags.

    Nope.  I'm just fed up supporting that piece of crap email client that sucks ass.

    Yes, I know you can use it to write applications, and we even have one that's not terrible.  But 90% of businesses use it for email, and it sucks ass for email.  It's slow.  It uses a brain-dead folder scheme that practically guarantees you'll accidentally delete messages.  It won't let you sort by subject.  The mousewheel doesn't work in every view.  The address book looks, and works, like it hasn't been modified since 1985.  In some views, it sorts users by first name... in some views it sorts users by last name... and there's never column headers to change sort order for users.  The address book has two pointless default entries that do nothing, but you can't get rid of them.  The "Edit Attachment" function is *perfect* for encouraging my users to delete their data without warning them.  (And there's no way to disable it with the admin utility.)  It adds the IM toolbar even after I specifically tell it I don't have an IM server.  (Yes, it's minor, but it's still stupid as hell.)  It often, like daily, brings up error dialogs that read, "this class does not contain that object" without telling you *which* class has the error or *which* object it lacks, making it impossible to debug *anything*.  It's bloated, it's slow.  When you hit the close box, Windows usually thinks it's not responding because it takes more than 15 seconds to close.  When it crashes, it won't run again until you run Windows again.  It wasn't multi-user aware until version 6 (even though version 4 ran on multi-user NT.)

    Try this.  Open Notes 6.5 and go to your In Box.  (The default template In Box that comes with Notes.)  Hit F6, and press right and left arrow... watch as the little pane reading "for James Schend" moves left and right for no apparent reason.  What the hell?

    Does Exchange suck?  Yes, it sucks.  Groupwise sucks, also.  In fact, all the groupware software out there sucks.  But Outlook is 100 times more pleasant to use than Notes, and my users all agree.

    BTW, you can be a "IBM shop" also... trust me, coping with OS/400, Infoprinters, Lotus Notes and "consultants" is much worse than anything Microsoft can throw at you.

    Oh, c'mon.  I've used Notes for nearly 10 years now and have never seen or had a problem with most of what you're talking about.  Seriously, the people that seem to have an unnatural hatred for all that is Notes seem to have the most bizarre problems that no one else seems to have ever encountered.  Most of the problems you seem to have with Notes are usability issues that can be resolved through training.  Other items, such as a crash requiring a reboot of Windows (actually, it depends on how and where the app crashed) are annoying but there are tools available to fix the problem without a reboot.

    The only complaint I ever had about Notes is that you don't use F5 as the refresh key as every other application known to mankind does.  But you know what?  Once you get over that, it's really not a big deal.

  • (cs) in reply to Schroeder

    <font size="1" style="font-family: verdana;">

    Schroeder:
    Most of the problems you seem to have with Notes are usability issues that can be resolved through training.


    <font size="2">Usability issues should be resolved through user interface changes, not training.  If it worked as expected, the training wouldn't be necessary, now would it?  (Hmm, maybe this is a scheme to keep "Notes consultants", or whatever they're called, employed.)</font>

    Schroeder:
    Other items, such as a crash requiring a reboot of Windows (actually, it depends on how and where the app crashed) are annoying but there are tools available to fix the problem without a reboot.


    <font size="2">The "tools" should be the developer's debugger and code editor.</font>
    </font>

    <font size="1" style="font-family: verdana;">

    Schroeder:
    The only complaint I ever had about Notes is that you don't use F5 as the refresh key as every other application known to mankind does.  But you know what?  Once you get over that, it's really not a big deal.
    </font>

    <font size="2" style="font-family: verdana;">If that's your only complaint, then you must have an incredibly high tolerance for pain.
    </font>

    <font size="2" style="font-family: verdana;">
    </font>

  • nobody (unregistered) in reply to DocJowles
    DocJowles:
    I'll do it to spare everyone else the trouble: The real WTF is the syntax of that language!

    And here I thought Perl was write-only.... damn!

  • rhs (unregistered) in reply to ZeoS

    Yeah, this is one WTF of a script, but judge the language itself in the proper context!  Sure, the language looks funny to real programmers, and especially so when you're looking at formulas written before Damien's re-write of the language, and even more especially so when you look at code produced by amateurs -- but it was the amateurs more than the real programmers who were the target audience for the language in the first place. 

    A little perspective here.  This is a language designed in the late 80s to run on 386 machines with 2 MB of RAM running OS/2 and Win16.  It was designed to allow very simple scripting in specific contexts, like providing a default value or a selection list for a field on a form, validating input for a field, or writing simple agents for making changes to existing documents (analogous to "records" in most other databases).  The original developers (including Ray Ozzie, and unless you've been living under a rock these past few months you know who he is and you know that Bill Gates has considered him one of the top few programmers in the world for a long time) wanted a powerful list processing language, and they got one.  They also had some specific ideas in mind that provided ways to simplify the implementation of the lanuage.  One idea was that it didn't need sorting in the language, because if you wanted to sort something you built a view (analogous to an "index") that would do the sorting for you and your could would just read the sorted data.  Another idea was that it didn't need looping, because there was an implied loop in agents designed to run the same sequence of instructions on "all documents" or "all selected documents".  Another idea was that the syntax should look familiar to "power users" (which in those days meant people who wrote their own spreadsheet formulas), instead of looking familiar to programmers.  Developers soon proved that these assumptions were short-sighted.  There were applications that people wanted to build in Notes that really did need sorting, and really did need looping, and it really needed a scripting language that looked and worked like other languages programmers were used to.  And guess what?   Lotus added a BASIC-derived language to the product in addition to the macro-style formula language, and smart programmers found ways to do sorting and looping in the formula language anyhow, despite the limits of the language.  The sort mechanism based on Notes unique list processing capabilites, though very strange to look at and limited to lists of no more than a few thousand entries, was actually one of the most ingenious pieces of programming I've ever seen.  Loops were accomplished, though only in certain circumstances, through indirect (i.e., "ping-pong") recursion.  And while developers certainly wanted an imporved language, IBM had some different needs -- like an absolute requirement that maintaining100% backward compatability with code that had to run withiin the constraints of late 80s and early 90s machines as an absolute requirement. For a very long time -- longer than many of today's popular scripting languages have been around at all, IBM just didn't dare try to do the total overhaul of the language's parser and execution engine that was needed to add looping.  Not until just a few years ago and Damien went and did it -- adding looping, as well as a construct more coimpact and more intuitive than @Subset() for accessing list elements, along with a wide variety of other language improvements -- and he did it with a top-to-bottom rewrite of the the entire language implementation while still maintaining compatability with a huge installed base of code. 

    And finally, let me ask you this:  how many other application scripting environments exist today that (a) have an installed base of more than 100 million users, and (b) can run scripts that were written more than 15 years ago to run on 386s running OS/2, and get the same results today running on contemporary Windows machines, contemporary Macs, and (real soon now) Linux, too? 

  • (cs) in reply to masklinn
    masklinn:
    hat's how Guido saw it, and that's how many Pythonistas see it. Now if you don't like it you don't have to use python

    That's a good idea. Next time I need to perform maintenance on one of the bunch of python scripts that are used everuwhere here, I'll just tell my boss to stuff it.

    Zlodo:
    Yeah. Instead, python gives you endless hours of fun when your indention settings doesn't matches the settings of the guy who originally wrote the script that you're modifying.

    God, seriously, not only is converting space to tabs and tabs to space trivial but tools like Pylint or Pychecker can take care of the automated validation of your indentation levels for you...


    Yeah. So instead of just using whatever text editor you have at hand to modify the script, you have to use a specific tool. Or how to turn a 30 seconds job into a 5 minutes one.

    Zlodo:
    It also gets hard to read very quickly because the blocks aren't visible quite as easily without braces.

    Uh... right... I realize that it'll probably hurts your feelings but everyone who's used Python for more than a day thinks you're wrong.


    I don't think that my feelings are the one that got hurt there. I just stated an opinion. You have the pretense to know what a large group of people (which does include me) thinks. It may hurt your feelings, but not everyone using python for more than a day is bound to fall in love with it. It is true for any language or technology.
    I did use python in various contextx, both professionally and as part of my hobbies, and while I wouldn't qualify myself as having a very long experience of it, I definately did more than skim the surface.

  • FootFetishist (unregistered) in reply to ZeoS

    I think what he meant is that in a functional language loops are not allowed and considered exactly as bad as goto because in fact they are just conditional non-deterministic gotos what makes them probably even worse.

    So in languages like Haskell, OCaml and so on you use recursion wich is damn cool if you got it once.
    One example woud be:

    allNumbersDownFrom val
      | val == 0    = []
      | otherwise = val : allNumbersDownFrom val-1

    here : is "item to front of list" concatenation and the |s are some kind of switch statement, but on a higher level.
    "allNumbersDownFrom 6" would return [6,5,4,3,2,1]
    You also have syntactic sugar to simplify it most of the time. This for example

    fiterAndApplyFunction function list filterFunction = [ function item | item <- list, filterFunction item ]

    does filter all "item"s of the "list" by checking if "filterFunction", when called with the value "item" returns true, and then applys function to them, returning a new list.

  • Oberon (unregistered) in reply to ZeoS
    ZeoS:
    wiggzie:
    before version 6 there was no looping so you had to do this sort of shit if you wanted to use formula language (all that @if crap). Anyone with a bit of cop on would have done this with lotusScript however



    R U kidding right? no loop??!?!?!?!?!? at least there must be a GOTO function, recursion?


    No Loop => No Programming Languaje!



    What about functional programming languages? Recursion is the goto of functional programming. No loop => No problem.

  • (cs) in reply to GoatCheez
    GoatCheez:
    It's been said already but... NO. In any of the C languages, linefeeds do not impact program logic, except for the // comment. This is one of the reasons I mainly use /* */. I think having whitespace, tabs, or linefeeds control program logic is a very bad idea for any language. Not all operating systems even have the same definition for the end of a line (crlf vs lf). The fact that a tab represents a large space just makes it difficult in a monospace world of code. Python is a great language, but for these reasons I have yet to actually use it. So sue me if I want my code too look like:

    Image.ReplaceColors(
                        ((System.Drawing.Color)arguments[0]),
                        ((System.Drawing.Color)arguments[1]),
                        ((System.Drawing.Color)arguments[2]));




    Linefeeds are also important in C for the pre-processor.   #define lines end with the line, unless you use a \ to continue onto the next line.

    Python supports the same thing \ can be used anytime you want to continue a line to the next.    Python is also smart enough to recognize ( start a block, and will allow lines to continue as you want inside parentheses.  Your code in python would look much the same, except you don't need the explicate casts, or the semicolon.

    The following is how your code could look in python.
    Image.ReplaceColors(
                                      arguments[0],
                                      arguments[1],
                                      arguments[2])

    Though I suspect the code could take a list instead of 3 arguments, so your might have

    Image.ReplaceColors(arguments)

    Course in C++ you can make arguments a std::vector and get the same thing, and C++ does overloading better.

    There are things not to like about python, but the ones you started are not among them.
  • stinkyfeet (unregistered) in reply to hank miller

    AFAIK, you can use braces in Python. Get over it already and complain about something more important.

  • Craig Ringer (unregistered) in reply to stinkyfeet

    While the code shown here is truly horrific, the language isn't actually so bad on the scale of things.

    Here's a sample of the PoS language called "Plain English" I have to maintain an ancient legacy app in. The language was developed in 1981 or so for DOS PCs then ported to multi-user Microsoft Xenix (shared ISAM files). It dead ended in about '84 with the death of the company. Nearly identical languages (this one is a rip-off) live on, to my horror, as win32 GUI database-integrated RADs. I have the 1983 implementation of Plain English running in a compatibility kernel personality on SCO OpenServer 5.0.5, which is another horror story in and of its self. The developer wrote the app in 1991 - on a RAD/DB tool EIGHT YEARS DEAD - because he didn't know anything else.

     CONVERT DATE is an object verb,
        1  Does  CUT  OBJECT  after  "."
        2   and  IF  HEAD  ^  "@"
             do  RETURN
        3   and  CUT  OBJECT  after  2
        4   and  COPY  HEAD  to  TEMP DAY
        5   and  CUT  TAIL  after  1
        6   and  CUT  TAIL  after  2
        7   and  COPY  HEAD  to  TEMP MONTH
        8   and  CUT  TAIL  after  1
        9   and  COPY  TAIL  to  TEMP YEAR
       10   and  JOIN  TEMP DAY  in front of  "."
       11   and  JOIN  HEAD  in front of  TEMP MONTH
       12   and  JOIN  HEAD  in front of  "."
       13   and  JOIN  HEAD  in front of  TEMP YEAR
       14   and  COPY  HEAD  to  OBJECT
       15   and  CUT  OBJECT  after  "
    @"

  • Craig Ringer (unregistered) in reply to Craig Ringer

    ... is this post editor from hell. Did you guys pick it because it fit in with the theme of the site, or did it just happen to work out that way? For us old-timers, I don't suppose there's any chance of a nice simple HTML edit widget with a preview button?

    This site is appreciated, but I suspect it'd be all the more so with a little editor love.

  • qwerty (unregistered) in reply to Craig Ringer

    Hey Craig, right underneath the edit box is a HTML tab widget thingy. Let me post a nice link as an example: porn. I think it messes up code tags, lemme try: this is code

      this
    is
    pre

      this 
    
    is 
      code 
    + 
      pre
    
    BTW I love your English program, it's the absolute worst programming language I've ever seen, easily outdoes COBOL multiplied with INTERCAL.
  • qwerty (unregistered) in reply to qwerty

    OK so that was an attempt at a piece of <code>, <pre>, and then <code><pre>.

    The preview button had to be killed because it utterly messed up people's posts. You may use the power combo of notepad + your browser as a preview facility ;-)

  • qwerty (unregistered) in reply to stinkyfeet

    Anonymous:
    AFAIK, you can use braces in Python. Get over it already and complain about something more important.

    Braces are not used for defining blocks in the snaky language.

    itslikethis = { brace:"creates a dictionary object" }

    So yeah, technically, you can use braces.

  • (cs) in reply to haveworld
    haveworld:

    You don't need a @Switch operator.
    @If works with multiple conditions (up to 99) without nesting
    @If( condition1 ; action1 ; condition2 ; action2 ; ... ; condition99 ; action99 ; else_action )


    Oh ... my ... god!  I was going to come to the defense of the @If operator and say, "Oh, that's just the Oracle DECODE operator."  But why would it be limited to some set number of conditions?  And if it is, why 99 instead of 32, or 256?

    *Shudder*

  • (cs) in reply to FootFetishist
    Anonymous:

    So in languages like Haskell, OCaml and so on you use recursion wich is damn cool if you got it once.

    allNumbersDownFrom val
      | val == 0    = []
      | otherwise = val : allNumbersDownFrom val-1



    That doesn't quite look like Ocaml, so I guess it must be Haskell.  Unfortunately, the way you've written it, it isn't tail recursive.  That's the PITA with languages that use recursion for looping.  If you write something nice and cleanly, it isn't fast because it isn't tail recursive so the compiler can't do TCO on it.  So then you end up writing:

    allNumbersDownFrom val
      allNumbersDownFromImpl val []

    allNumbersDownFromImpl val list
      | val == 0    = list
      | otherwise = allNumbersDownFromImpl val-1 (val : list)

    Now it's fast, but it isn't so nice and clean any more.  *Shrug*

  • Bernard Devlin (unregistered) in reply to Damien Katz

    Last week I had thousands of XML files with different structures to process and format into HTML. There was no DTD.   I looked at various ways of doing it (XSL, XMLC, Sitemesh, WebObjects, LotusScript, even Javascript)... It looked like it was going to be a complicated nightmare no matter which option I went with (XML started to seem like an abomination).  In the end I decided to look at doing it in the Notes formula language.  I'm no @formula guru, but it was easy and fast to do it using @abstract, @right, @left, and @ReplaceSubstring.  And that was in R5 without all the additions added in R6.  People seem to have really lost sight of the fact that Notes was devised to process text.

  • (cs) in reply to DrCode
    DrCode:
    haveworld:

    You don't need a @Switch operator.
    @If works with multiple conditions (up to 99) without nesting
    @If( condition1 ; action1 ; condition2 ; action2 ; ... ; condition99 ; action99 ; else_action )


    Oh ... my ... god!  I was going to come to the defense of the @If operator and say, "Oh, that's just the Oracle DECODE operator."  But why would it be limited to some set number of conditions?  And if it is, why 99 instead of 32, or 256?

    *Shudder*



    Again, consider this in the context of a macro language rather than as a Turing-complete programming language (although Damien's rewrite brings it there). I have never had occasion to use anything like a "substantial fraction" of the 99 possible conditions. Frankly, I can't imagine a situation where I would have to go anywhere near the limit -- there's almost always a better way to code conditionals in any language than to run a single-layer if/elseif/else with 100 or more forks or a switch with 100 or more hard-coded conditions (prior to optimisation). That kind of code makes me shudder.

    As mentioned in the original post, the WTF here is that the whole thing could have been replaced with the fieldname. (The syntax, by the way, would have been: exp_newlocation. No quotes, no =, no @, nothing added.) The Notes Formula Language is deceptively powerful if used with a bit of thought. For instance, to create a  set of links on any Domino web page (Notes document in disguise, if you will) to PDFs and only PDFs from an unknown number of file attachments  of unknown types:


    list := @Trim(@LeftBack(@AttachmentNames;".pdf"));
    @If(list = ""; @Return(""); "");
    list2 := list + ".pdf";
    "<a href=\"/" + @WebDbName + "/0/" + @Text(@DocumentUniqueID) + "/$File/" + list2 + "\" class=\"pdfLink\" title=\"Download Acrobat file " + list2 + "\">" + list2 + "</a>");

    No looping required, and the only if is there to prevent an empty link tag from happening if there are no file attachments with the .pdf extension. If there are any PDFs attached, whether one or dozens, an individual link for each will be produced by that one little bit of code.

    That's the sort of context in which Formula Language is used. There are other languages for other contexts.
  • (cs) in reply to Stan Rogers
    Stan Rogers:


    list := @Trim(@LeftBack(@AttachmentNames;".pdf"));
    @If(list = ""; @Return(""); "");
    list2 := list + ".pdf";
    "<a href=\"/" + @WebDbName + "/0/" + @Text(@DocumentUniqueID) + "/$File/" + list2 + "\" class=\"pdfLink\" title=\"Download Acrobat file " + list2 + "\">" + list2 + "</a>");


    Dammit -- that last line should have read:

    "<a href=\"/" + @WebDbName + "/0/" + @Text(@DocumentUniqueID) + "/$File/" + list2 + "\" class=\"pdfLink\" title=\"Download Acrobat file " + list2 + "\">" + list2 + "</a>"

    (Pulled from a longer routine and poorly edited by an idiot during posting.)

  • (cs) in reply to Grizzled

    Why buy a product that has is an Apps Server, Email, Web Server, Supports remote working, Easy Access to Relational Database's, 3 fully functional languages (Formula's (a pain to write but for simple stuff is great!), Lotus Script and Java (If Java is so crap why did MS base C# partly on it?) out of the box

    - or -

    Buy lots of boxes from MS to do the above? (ps: They still havent got a good remote working tool) and of course lots of servers to install all those boxes on to?

     

    A grizzled Lotus Notes, Relational Database, VB.Net, C# and Java developer

     

  • Jim (unregistered) in reply to DrCode
    That doesn't quite look like Ocaml, so I guess it must be Haskell.  Unfortunately, the way you've written it, it isn't tail recursive.  That's the PITA with languages that use recursion for looping.  If you write something nice and cleanly, it isn't fast because it isn't tail recursive so the compiler can't do TCO on it.


    Luckily, in Haskell, the list is contructed lazily, so TCO ends up being much less important than deforestation.
  • (cs)

    Nice to see why one can only have 50 rules that actually do something...

Leave a comment on “Listing a List”

Log In or post as a guest

Replying to comment #53747:

« Return to Article