BaCon on Hacker News
Jan 30, 2017 20:28:49 GMT 1
Post by Pjot on Jan 30, 2017 20:28:49 GMT 1
All,
Recently, the BaCon project was mentioned at Hacker News by a BaCon user:
news.ycombinator.com/item?id=13513498
Regarding the questions raised, the following are my responses.
BaCon does not use an external library like the Boehm Garbage Collector for its memory management. This is intentional, because the goal of the project is to be as compliant with as many operating systems as possible. Therefore, it needs to be independent, and it is because of this independence that it can be compiled and executed on an Android device, for example.
Instead, BaCon uses an internal mechanism to free allocated memory. When a malloc occurs in a SUB or FUNCTION, then BaCon automatically will add code at the exit of the sub/function to free the memory. The STATIC keyword simply prevents BaCon from adding such code.
In case of global arrays, the allocation of static arrays is done outside a function. The declaration of a global dynamic array name will be done of outside the function as well, and the malloc returns a pointer to some memory on the heap, which simply is not freed when exiting a SUB or FUNCTION.
There really is no magic here, it is all plain ANSI C compliant stuff.
The 'target audience' is simply anyone who is interested. For example, I myself belong to the target audience, because I like the nostalgic nature of BASIC, and at the same time, BaCon actually can do something useful. But there can be any reason to have interest in BaCon.
It is not an experiment, nor a 'hobby'. It is a spare-time project, to give something (back) to the world. There is no commercial objective, no prototyping intention (though you probably can implement a prototype for some concept quickly), and there is no goal in terms of world domination. The BaCon project exists pure for the fun of programming and hacking, in the positive meaning of the word 'hacking' (e.g. improving ones life behind the computer).
BR
Peter
PS BaCon exists since March 2009, see the CHANGES file for all release dates.
Recently, the BaCon project was mentioned at Hacker News by a BaCon user:
news.ycombinator.com/item?id=13513498
Regarding the questions raised, the following are my responses.
I didn't see anything in the documentation about garbage collection and reference counting. The language has the ability to return arrays from functions, but the arrays are required to declared static. How is this different from just declaring a global array? How does the language prevent memory leaks with strings and arrays?
BaCon does not use an external library like the Boehm Garbage Collector for its memory management. This is intentional, because the goal of the project is to be as compliant with as many operating systems as possible. Therefore, it needs to be independent, and it is because of this independence that it can be compiled and executed on an Android device, for example.
Instead, BaCon uses an internal mechanism to free allocated memory. When a malloc occurs in a SUB or FUNCTION, then BaCon automatically will add code at the exit of the sub/function to free the memory. The STATIC keyword simply prevents BaCon from adding such code.
In case of global arrays, the allocation of static arrays is done outside a function. The declaration of a global dynamic array name will be done of outside the function as well, and the malloc returns a pointer to some memory on the heap, which simply is not freed when exiting a SUB or FUNCTION.
There really is no magic here, it is all plain ANSI C compliant stuff.
I am very curious what is the target audience for this project ? Given its long history (dating back to 2011) it does not look like just an experiment or hobby project. I would have assumed it to be a solution for porting legacy programs but it implements a custom basic dialect so that is largely out of question. Is it intended to be a solution for rapidly prototyping performant systems applications ?
The 'target audience' is simply anyone who is interested. For example, I myself belong to the target audience, because I like the nostalgic nature of BASIC, and at the same time, BaCon actually can do something useful. But there can be any reason to have interest in BaCon.
It is not an experiment, nor a 'hobby'. It is a spare-time project, to give something (back) to the world. There is no commercial objective, no prototyping intention (though you probably can implement a prototype for some concept quickly), and there is no goal in terms of world domination. The BaCon project exists pure for the fun of programming and hacking, in the positive meaning of the word 'hacking' (e.g. improving ones life behind the computer).
BR
Peter
PS BaCon exists since March 2009, see the CHANGES file for all release dates.