Quicksort is possible (but, obviously, not as quick) without pointers. Honestly, when the code is executed in the VM anyway, I'm not sure why Blizzard disabled pointers when you can just jail them to the VM memory space. However, these sorting algorithms are possible without pointers.
Obviously, though, they are VERY non-flexible and have to be explicitly made for each structure you want to sort, which is a major problem.
Blizzard implemented some sorting algorithms already (including bubble - and quicksort), you can look up their implementations in the standard libraries.
If Galaxy were compiled to real executable code processed directly by the processor, then you could mess around the memory space of the process and other nasty things (modify file system, install viruses, whatever).
But Galaxy is all executed within a VM (Virtual Machine), which interprets the instructions and ensures all memory accesses stay inside the interpreted code's memory space. It may be 100 times slower but is quite safe (when properly written anyway).
Blizzard implemented some sorting algorithms already (including bubble - and quicksort), you can look up their implementations in the standard libraries.
Im not aware of the built in array sorting functions.... I may update this test map to use it just to try them out.
someone requested how to do this.
So i just made a sample map for them to learn from.
Eheh nice, bubble sort.
I find it very awkward writing code in a language without pointers (and structs), the "good" sorting algorithms aren't even possible to write.
Quicksort is possible (but, obviously, not as quick) without pointers. Honestly, when the code is executed in the VM anyway, I'm not sure why Blizzard disabled pointers when you can just jail them to the VM memory space. However, these sorting algorithms are possible without pointers.
Obviously, though, they are VERY non-flexible and have to be explicitly made for each structure you want to sort, which is a major problem.
Blizzard implemented some sorting algorithms already (including bubble - and quicksort), you can look up their implementations in the standard libraries.
@DarkRevenantX: Go
I heard somewhere that it was because pointers can allow hackers to play around with your mem-stack, which is potentially dangerous?
If Galaxy were compiled to real executable code processed directly by the processor, then you could mess around the memory space of the process and other nasty things (modify file system, install viruses, whatever).
But Galaxy is all executed within a VM (Virtual Machine), which interprets the instructions and ensures all memory accesses stay inside the interpreted code's memory space. It may be 100 times slower but is quite safe (when properly written anyway).
@StragusMapster: Go
Are people really sorting such large data sets in maps that they need to be using a sorting algorithms like these?
Im not aware of the built in array sorting functions.... I may update this test map to use it just to try them out.
Its not a matter of sorting anything large.... The thing is, sometimes you just need to sort a couple numbers. This get the job done.