Advertisement
code_gs

Untitled

Jun 8th, 2020
1,358
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.85 KB | None | 0 0
  1. # Interfaces are concepts. Duck typing, not direct inheritence
  2.  
  3. # MemoryBounds is a constant UInt representing the pointer bytes, provided by lua impl
  4. using USize = UInt<MemoryBytes>; # Yuck
  5. # using, delete, count (operator for counting varargs, count(...). count(1, "poop", 3) will return 3)
  6.  
  7. class Array<IType _Type, USize _uElements>; # Primitive class, provided by lua impl
  8.  
  9. # Preceding . goes to the global scope. Ex. .Vector
  10.  
  11. # can classes be overwritten? Added to later?
  12. # Function polymorphism and template specialization is chosen by declaration order.
  13.  
  14. # How to alias functions, select specific headers, rearrange function lists
  15.  
  16. # Are functions constant? foo() Ret {} vs foo = () Ret {}
  17.  
  18. library math
  19. {
  20.     class Vector<INumber _Type, UnsignedSize _uDimensions>
  21.     {
  22.         using Type = _Type;
  23.         using Dimensions = _uDimensions;
  24.        
  25.         ctor()
  26.         {}
  27.        
  28.         ctor(List<ICastable<Type>> list)
  29.         {
  30.             m_tData(list);
  31.         }
  32.        
  33.         # FIXME: VERY iffy on this syntax for type patterns/repetition
  34.         # This means the function takes n args based on the template arg
  35.         # Ex. Array<USize 4> myarray(1, 2, 3, 5)
  36.         # Need a better way to define sequences
  37.        
  38.         # Return type is implied nil/void
  39.         Set([Type]...<0, Dimensions> args) # Class...<min, max>
  40.         {
  41.             # FIXME, will self be const here? Will const variables be const here? How to handle const initialization
  42.             m_tData(args...); # Same as args<0 .. count(args...)> maybe? Need to figure out how sequences will work
  43.         }
  44.        
  45.         # FIXME: REALLY gotta work this out, Function Lists and such
  46.         ctor([Type]...<0, Dimensions> args) = Set([Type]...<0, Dimensions> args);
  47.        
  48.         private:
  49.             Array<Type, Dimensions> m_tData;
  50.     }
  51. }
  52.  
  53. interface Foo
  54. {
  55.     # Foo
  56. }
  57.  
  58. # Foo<Bar> returns a bool, can be used in templates as concepts
  59.  
  60. interface Foo2<IType Arg>
  61. {}
  62.  
  63. # Foo2<Bar> returns an interface, Foo2<Bar><Bar2> returns a bool
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement