Kara-Moon Forum
April 18, 2024, 12:17:02 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News: You can go back to the main site here: Kara-Moon site
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Version 20.12.1 Available  (Read 3474 times)
bvdp
Kara-Moon Master
****
Posts: 1437


WWW
« on: January 23, 2021, 11:42:21 PM »

I have just posted a "developer" version of MMA on our website.

    https://mellowood.ca/mma/downloads.html#developer

As always, please have a go with the new features and let me know if you find any problems.
Logged

My online life: http://www.mellowood.ca
sciurius
Sr. Member
****
Posts: 443



« Reply #1 on: January 24, 2021, 02:12:36 PM »

Thanks, good job!

I've noticed that even though the site reads "please read the file text/CHANGES-** for complete details" the CHANGES-20 file doesn't have a section for 20.12.1.

RPMs for Fedora and other RPM based Linux distros are downloadable from https://www.squirrel.nl/pub/MMA/ .
Logged
sciurius
Sr. Member
****
Posts: 443



« Reply #2 on: January 24, 2021, 02:51:34 PM »

Calling a subroutine with insufficient number of arguments no longer gives an error, but the missing arguments get the value "UNDEFINED".

This is not documented, and not in the CHANGES file.

Now we can test for empty values, wouldn't is be better to change the missing argument values to empty instead?

Even better maybe: check for the correct number of arguments as in previous versions, but allow Default to specify an empty value, e.g.

Code:
DefCall Foo Bar
Default Bar
IfEmpty Bar
...
EndIf
EndDefCall

Does that sound sensible? As long as it is not documented we can change it...
Logged
bvdp
Kara-Moon Master
****
Posts: 1437


WWW
« Reply #3 on: January 24, 2021, 10:44:22 PM »

I've noticed that even though the site reads "please read the file text/CHANGES-** for complete details" the CHANGES-20 file doesn't have a section for 20.12.1.

Nice to see the continued posting of the RPMs. Appreciated.

The CHANGES file should be read from the bottom up. The new stuff is that upto the last release (in this case 20.12). Usually, I have a line "Released xx.xx ..." at the bottom of the file. Somehow I missed that ... and I don't know why! Oh well, it is there now.
Logged

My online life: http://www.mellowood.ca
bvdp
Kara-Moon Master
****
Posts: 1437


WWW
« Reply #4 on: January 24, 2021, 11:04:34 PM »

Calling a subroutine with insufficient number of arguments no longer gives an error, but the missing arguments get the value "UNDEFINED".

This is not documented, and not in the CHANGES file.

Now we can test for empty values, wouldn't is be better to change the missing argument values to empty instead?

Even better maybe: check for the correct number of arguments as in previous versions, but allow Default to specify an empty value, e.g.

Code:
DefCall Foo Bar
Default Bar
IfEmpty Bar
...
EndIf
EndDefCall

Does that sound sensible? As long as it is not documented we can change it...

I'm not sure if the UNDEFINED thing should be there ... it might be a leftover from testing. But, what are we screwing around with this ... you can already set default values when you define a subroutine.

Code:
DefCall FunName2 arg1=123
 print $arg1
EndDefCall

Perhaps the missing part is that you can't set arg1 to a null? Well, you can:

Code:
Set foo
Call FunName2 Foo
DefCall

which prints "UNDEFINED" ... hmm, I think the idea was that the function would check for the value "UNDEFINED" and act accordingly. However, if you change line 175 in func.py from "UNDEFINED" to "" it might work?? No, it doesn't ... but " " does. The problem is not in the function but in the other macro handlers ... I hate to start to work all though this for an exceptional case and introduce some other problems.


Logged

My online life: http://www.mellowood.ca
bvdp
Kara-Moon Master
****
Posts: 1437


WWW
« Reply #5 on: January 24, 2021, 11:05:09 PM »

And I will add the UNDEFINED issue to the docs Smiley
Logged

My online life: http://www.mellowood.ca
bvdp
Kara-Moon Master
****
Posts: 1437


WWW
« Reply #6 on: January 24, 2021, 11:44:47 PM »

I will look, again, at the UNDEFINED code and do a walk though to see if there is a simple solution Smiley
Logged

My online life: http://www.mellowood.ca
sciurius
Sr. Member
****
Posts: 443



« Reply #7 on: January 25, 2021, 07:22:08 AM »

The question originated when I tried to find a way to call a subroutine both with and without arguments, without having to specify a default value.

At the time I used

Code:
DefCall Foo Chords=__OMITTED__
 If Ne $$Chords __OMITTED__
    ...
 EndIf
EndDefCall

This works, but now we have the possibility to test for empty, it would be better to use that. AFAICS the only required change would be to allow the second argument to Default to be omitted, just like wih Set:

Code:
DefCall Foo Chords
 Default Chords
 IfEmpty Chords
    ...
 EndIf
EndDefCall

I think it is valuable that the parameter validation still works. Leaving out parameters when they should be there should always signal an error.
Logged
sciurius
Sr. Member
****
Posts: 443



« Reply #8 on: January 25, 2021, 09:28:00 AM »

With the attached minimal patch, the following test passes:

Code:
DefCall Foo Chords
  Default Chords
  If IsEmpty Chords
    print Call Foo with no args
  Else
    print Call Foo with $Chords
  EndIf
EndDefCall

Call Foo Bar
Call Foo

AFAIC the UNDEFINED hack can go.

* emptydef.txt (1.4 KB - downloaded 170 times.)
Logged
bvdp
Kara-Moon Master
****
Posts: 1437


WWW
« Reply #9 on: January 25, 2021, 05:01:53 PM »

Looks like you beat me to it Smiley I'll run this though the torture test later ... Thanks.
Logged

My online life: http://www.mellowood.ca
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines Valid XHTML 1.0! Valid CSS!
Page created in 0.055 seconds with 20 queries.