|
Post by rikky on Nov 2, 2022 8:15:37 GMT 1
I don't know if this is a bug or a feature. It's probably both. SUB bla PRINT "bla" END SUB
SUB bla() PRINT "blabla" END SUB
bla bla()
result: blabla blabla So bla() gets precedence over bla. Nice feature tough. For example if you are working with something in HTML and you want to change a BaCon keyword slightly: SUB PRINT(string$) PRINT string$ & "<br>" END SUB
PRINT("hello BaCon")
result: hello BaCon<br> Rik.
|
|
|
Post by Pjot on Nov 3, 2022 7:16:40 GMT 1
I don't know if this is a bug or a feature. It's probably both. Hi rikky, What happens is that BaCon will convert both SUBs called 'bla'. As the conversion starts from the top of the program, the second 'bla' will overwrite the first one. So in the end, the generated C code contains one function 'bla' which is executed. Technically, we could call this a 'bug', because you'll end up with code which is not doing anything (e.g. the first 'bla' function); you will never be able to invoke the SUB which is defined first. But then again, who defines two functions with the same name? Anyway, I can add a check to prevent duplicate FUNCTION or SUB names. Best regards Peter
|
|
|
Post by rikky on Nov 3, 2022 15:47:58 GMT 1
Everybody makes mistakes I guess? Thanks.
|
|
|
Post by Pjot on Nov 3, 2022 18:54:06 GMT 1
Everybody makes mistakes I guess? Absolutely! I make them too, so it is solved in the latest beta. Regards, Peter
|
|