Author Topic: What would you want from TorqueScript?  (Read 3136 times)

If you could add any features or libraries to the TorqueScript language, what would they be?
I'll consider implementing each where viable in an upcoming large combined resource.

What you shouldn't recommend (already done):

  • Collection data types (Array, Map, Set, Queue, Stack, Tuple, etc) unless it's an uncommon one
  • "Callable" type (i.e. for extended callbacks) that supports sugaring, namespaced and object methods.
  • Iterators / iteration.
  • Functional interfaces (specifically reduce, apply, map, enumerate, range, join, all and any)
  • Extended console output support
  • String formatting (a la printf) + case-sensitive ASCII table lookup
  • User-defined classes with method inheritance
  • EventEmitter base classes
  • Byte-based, seekable file streams
  • Event-based use-agnostic TCP sockets
  • Generic programming features (i.e. +, -, *, /, [], ., ==, <, >, etc operators extensible by object types)
  • Garbage collection
  • Regex engine
  • ByteArray, Struct
  • INI reader/writer/interface
  • JSON parser/serializer
  • Redis client
  • Extensible, object-based, seeded random number generation - currently 31-bit LCGs and Mersenne Twisters are available

lambda functions ;)

Though, they already exist, sort of, via eval.

How about a true random number generator c:

Is this written in TorqueScript?

How about a true random number generator c:
If you mean a CSPRNG then that's dooable if someone implements AES or some other popular block cipher.'

*true* random numbers do not exist because true randomness contradicts itself. Not sure where I got this from, but I looked it up again and it isn't true.
« Last Edit: October 30, 2014, 12:57:11 AM by Ipquarx »

*true* random numbers do not exist because true randomness contradicts itself.
Haha, true random number generators do exist though
Although it probably wouldn't be possible to do in Torquescript,
iirc usually true rngs use the background radiation and the imperfections in the measuring tool to make truely random numbers.

http://en.wikipedia.org/wiki/Random_number_generation#.22True.22_random_numbers_vs._pseudo-random_numbers

Haha, true random number generators do exist though
Although it probably wouldn't be possible to do in Torquescript,
iirc usually true rngs use the background radiation and the imperfections in the measuring tool to make truely random numbers.

http://en.wikipedia.org/wiki/Random_number_generation#.22True.22_random_numbers_vs._pseudo-random_numbers
I actually looked it up, and apparently true randomness only comes from quantum events. https://qrng.anu.edu.au/

I actually looked it up, and apparently true randomness only comes from quantum events. https://qrng.anu.edu.au/
So I guess background radiation isn't truely random, but here's the quantum events that are classified as being random:
http://en.wikipedia.org/wiki/Hardware_random_number_generator#Physical_phenomena_with_quantum-random_properties

For any practical purposes however, one can use a block cipher like AES in Counter mode with the seed being a 256-bit (32 byte) key.

« Last Edit: October 30, 2014, 03:52:57 PM by portify »

Would be nice if the console could do that thing you see in python where it always echoes the result of the input you give it without needing to be told to. Tried to get it to do that myself and ended up running into a weird bug when you mix echo and eval together in some way.


Would be nice if the console could do that thing you see in python where it always echoes the result of the input you give it without needing to be told to. Tried to get it to do that myself and ended up running into a weird bug when you mix echo and eval together in some way.

A simple way of achieving that would just be relying on entering expressions rather than statements, since it'd mostly remove the need to parse the input. For example:

==>repr(-1 / 0);
==>repr(-1 / 0)
-Infinity


... which would check if it ends with ; and replace it with echo(<input>);
Granted, that'd break with ==>echo("test"); 5
« Last Edit: October 31, 2014, 06:58:52 PM by portify »

How about something that'll let me chain functions that have schedule loops together? For example, in my dungeon generator, I have different phases; Creating random room sizes, positioning each room, working out what rooms should be connected, finding positions for the doors, etc. Some of these steps are instant, some take several seconds (with the function calling itself in schedule), they all know the conditions of when their job is done, I'd like to be able to pass each function into something, then when they're done, it calls the next step.