• Pag (unregistered)

    They'll ship a date-handling library eventually, but 4D time being you have to roll your own.

  • Fred (unregistered)

    Still better than JavaScripts date handling.

  • g (unregistered)

    There's another wtf in there; it's only grabbing the last two digits of the year. The resulting string will be 24SEP25, so you have the added pleasure of wondering if it's September 24th of 2025, or September 25th of 2024.

  • (nodebb)

    4D was an RDBMS

    Thank you so much for bringing up such a painful subject. While you're at it, why don't you give me a nice paper cut and pour lemon juice on it?

  • Jonathan (unregistered)

    What I want to know is, as people were reading the code what language were they guessing this was written in?

    Me, my best guess was that someone had decided to graft Perl and COBOL together.

  • (nodebb)

    Looks to be Pascal inspired to me from ":=" and "case of".

  • Tim (unregistered) in reply to Jonathan

    I asked ChatGPT before I even started to read the narrative and it got the right answer. the bit that really confused me was

    C_STRING(2;$currentDay;$currentYear)

    it looks like a function call, but a function call makes no sense in this context

  • (nodebb)

    I thought I knew about all the "platforms" out there, but no, somehow such a long-running product totally escaped me.

    Addendum 2025-09-24 12:40: PS. Imagine looking for talent OR looking for a job as a 4D specialist. :)

  • (nodebb) in reply to Tim

    it looks like a function call, but a function call makes no sense in this context

    I think what this is, is a variable declaration — or actually, two variable declarations in one, as they’re both to be strings of 2 characters (or bytes, or something anyway) in length. C_STRING declares the variable, the first parameter is the length, every parameter after that is a variable name that will be declared to fit this mould.

  • dusoft (unregistered) in reply to Tim

    yep: "Based on the syntax and function names, the code snippet appears to be written in 4D, a programming language and integrated development environment (IDE) for building business applications.

    [snip]

    The code's purpose is to format a date, likely converting a date variable ($1) into a string representation like "JAN 25 2025" for a specific use case."

    but clearly inspired partially by Pascal.

  • Officer Johnny Holzkopf (unregistered) in reply to Gurth

    Interesting difference: While $currentMonth is a string of length 2 (2 bytes, 2 characters, 2 number symbols, 2 pieces, whatever), $month is declared as integer for the numerical comparing "Case of" block. Is there no way of accessing the "month property" for comparison directly? Also using the prefix "current" is a bit strange - the current date is derived from the C_DATE in $1, so it represents that exact date... it's all very strange...

  • afo (unregistered)

    Oh I remember having to develop a 4D webapp in my MA internship. With the added bonus that, in the French version of 4D, they also translated the programming language. PHP is absolutely a joy to work with compared to that abomination.

  • (nodebb) in reply to Officer Johnny Holzkopf

    Going by how values are assigned to $currentDay, $month and $currentYear, I get the impression that C_DATE produces a dictionary or something similar, which you can ask for its Day, Month and Year properties. So I guess they could have done:

    Case of
    
    : (Month of($1)=1)
    

    But perhaps decided it would be more readable to put the value into $month? Or, for all I know, getting Month of($1) takes appreciably longer than getting $month?

  • (nodebb) in reply to Jonathan

    My first guess was: PHP and PLSQL had an unholy a deformed child. But given the "PHP support" of 4D, it might be more accurate that I would have liked.

    Addendum 2025-09-25 05:17: My first guess was: PHP and PLSQL had an unholy and deformed child. But given the "PHP support" of 4D, it might be more accurate that I would have liked.

    EDIT: Oh GODS the gui for editing posts in the worst fucking thing I've ever seen.

    Addendum 2025-09-25 05:18: EDIT 2: And it doesn't even allow you to actually edit everything, just add an addendum. Now I look stupid.

  • Vera (unregistered) in reply to Jonathan

    I also thought it was COBOL at first, due to the strings specifying their length in the definitions.

Leave a comment on “Across the 4th Dimension”

Log In or post as a guest

Replying to comment #684678:

« Return to Article