Author Topic: miniSphere 4.5.8  (Read 111817 times)

Offline Fat Cerberus

  • miniSphere Developer
  • Verified
  • Legendary Poster
  • *
  • Posts: 2117
  • *MUNCH*
    • View Profile
Re: miniSphere 4.5.6
« Reply #1530 on: March 11, 2017, 02:11:17 am »
By the way there's an important change in 4.5.6 for from() queries.  Whereas before for...of over a query would enumerate key-value pairs, now it will only enumerate the values.  This change lets you keep a query around as if it were a "live array":

Code: Javascript
  1. evenNumbers = from(listOfNumbers).where(v => v % 2 === 0);
  2.  
  3. // print all the even numbers in listOfNumbers (live!)
  4. for (let n of evenNumbers) {
  5.     console.log(n);
  6. }
  7.  

That also lets you avoid wasting memory for a concrete array by alleviating the need for .select() in most cases.  Even better, by iterating through a query like that, you maintain the lazy evaluation behavior--as opposed to .select() which needs to run it to completion so it can return an array of the results.  In contrast, you can break out of the for...of early if needed, and the remainder of the results don't need to be processed.
miniSphere 4.5.8 - Cell compiler - SSJ debugger
Forum Thread | GitHub Repo

Offline Fat Cerberus

  • miniSphere Developer
  • Verified
  • Legendary Poster
  • *
  • Posts: 2117
  • *MUNCH*
    • View Profile
Re: miniSphere 4.5.6
« Reply #1531 on: March 13, 2017, 02:34:15 am »
It will soon be even easier to use the threads module when using ES6:

Code: Javascript
  1. import { Thread } from 'threads';
  2.  
  3. class SomeEntity extends Thread
  4. {
  5.     constructor()
  6.     {
  7.         super({ priority: 812 });
  8.         // initialize entity
  9.     }
  10.  
  11.     /* methods... */
  12.  
  13.     on_update()
  14.     {
  15.         /* update stuff... */
  16.     }
  17.  
  18.     on_render()
  19.     {
  20.         /* render stuff... */
  21.     }
  22. }
  23.  

Then:

Code: Javascript
  1. let myEntity = new SomeEntity();
  2.  
  3. myEntity.start();  // starts the thread running
  4. myEntity.stop();   // kills the thread
  5. myEntity.join();   // blocks until thread dies
  6.  

No fiddling with thread IDs! :D
miniSphere 4.5.8 - Cell compiler - SSJ debugger
Forum Thread | GitHub Repo

Offline Fat Cerberus

  • miniSphere Developer
  • Verified
  • Legendary Poster
  • *
  • Posts: 2117
  • *MUNCH*
    • View Profile
Re: miniSphere 4.5.7
« Reply #1532 on: March 14, 2017, 02:35:44 am »
4.5.7 fixes the Sphere Studio project template so it compiles out of the box again.
miniSphere 4.5.8 - Cell compiler - SSJ debugger
Forum Thread | GitHub Repo

Offline Zechs

  • Newbie
  • *
  • Posts: 15
  • Zechsual Intension
    • View Profile
Re: miniSphere 4.5.7
« Reply #1533 on: March 14, 2017, 01:00:28 pm »
4.5.7 fixes the Sphere Studio project template so it compiles out of the box again.
Is this in reference to it not finding the Cellscript file? That was my issue. I haven't had a chance to touch it since, mind you, but I was running into that.

Offline Fat Cerberus

  • miniSphere Developer
  • Verified
  • Legendary Poster
  • *
  • Posts: 2117
  • *MUNCH*
    • View Profile
Re: miniSphere 4.5.7
« Reply #1534 on: March 14, 2017, 01:40:03 pm »
Yeah, related to the default Cellscript having an "import" statement, which now needs it to be a .mjs file.  The new project had it named as Cellscript.js which caused it to fail.
miniSphere 4.5.8 - Cell compiler - SSJ debugger
Forum Thread | GitHub Repo

Offline Zechs

  • Newbie
  • *
  • Posts: 15
  • Zechsual Intension
    • View Profile
Re: miniSphere 4.5.7
« Reply #1535 on: March 14, 2017, 01:42:49 pm »
Agh, I did look at it and wonder if the filename was the issue, as I remember you mentioning the integration of .mjs. I didn't try it, though it couldn't have hurt.

Offline Fat Cerberus

  • miniSphere Developer
  • Verified
  • Legendary Poster
  • *
  • Posts: 2117
  • *MUNCH*
    • View Profile
Re: miniSphere 4.5.7
« Reply #1536 on: March 14, 2017, 10:25:53 pm »
New branch policy for the Git repo: Development of the next version (right now planned as 5.0) with on "dev" branch, while "master" will be latest-stable.  Historically I've developed directly against the trunk, which is starting to delay major overhauls; by committing everything directly to master, patch releases only intended to fix bugs end up getting breaking changes too, so I end up holding off on doing them.  Which slows down development.
miniSphere 4.5.8 - Cell compiler - SSJ debugger
Forum Thread | GitHub Repo