Ivo Balbaert
Ivo Balbaert
MModular
Created by Ivo Balbaert on 1/7/2025 in #questions
Try finally when opening a file
Hi all, the following code: fn main() raises: var file: FileHandle try: file = open("my_file.txt", "r") print(file.read()) finally: file.close() # =>error: use of uninitialized value 'file' gives an error in the finally clause. Adding except doesn't help. Why is file not visible in finally? Thanks!
13 replies
MModular
Created by Ivo Balbaert on 12/17/2024 in #questions
Is there a way in Mojo to know the type of a variable/object ?
Something like type() in Python. If not, is this useful and/or on the roadmap?
93 replies
MModular
Created by Ivo Balbaert on 6/14/2024 in #community-showcase
Mojo in the Tiobe-index
Arguments can be made about the usefulness of the Tiobe index, but the measure of Mojo's popularity in it grew from #184 in Nov 2023 to somewhere in the range from #51 to #100 in Jun 2024 (the index doesn't specify the position in that range). This is an amazing growth-rate in only 7-8 months, many interesting languages (for example Pony) never made it that far. Mojo certainly has the potential to raise to the range 20-50 (where we will know the exact position) and beyond, we'll notify you when it does.
7 replies