Forum Replies Created
-
AuthorPosts
-
Really.. thanks!
New question. Mark, please check this code. If we comment import of reflection – code works, else – don’t work.
Monkey12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667Namespace test.stack#Import "<std>"#Import "<mojo>"#Import "<reflection>"Using std..Using mojo..Function Main()Local awake:=New AwakeLocal awk:=Cast<IBehAwake>( awake )Local stack:=New Stack<BehWrapper<IBehAwake>>RemoveFromStack( Varptr stack,awk,BehWrapper<IBehAwake>.Equals )EndInterface IBehAwakeMethod Awake()EndInterface IEnabledProperty isEnabled:Bool()EndClass BehWrapper<T>Field state:IEnabledField source:TMethod New ( source:T,state:IEnabled )Self.source=sourceSelf.state=stateEndFunction Equals:Bool( lhs:BehWrapper<T>,rhs:T )Return lhs.source=rhsEndEndClass Awake Implements IBehAwakeMethod Awake()EndEndFunction RemoveFromStack<T,V>:Bool( stackPtr:Stack<T> Ptr,value:V,equals:Bool( lhs:T,rhs:V ) )Local stack:=stackPtr[0]For Local i:=0 Until stack.LengthIf equals( stack[i],value )stack.Erase( i )Return TrueEndifNextReturn FalseEndAlso I intrested in further improvement of reflection (generics, instance creation).
Is it possible to add into reflection module function like NewInstance( stringNameOfType:String )?
and use like this
Monkey12Local rect:=NewInstance( "Recti" )rect.x=50 ; rect.y = 20 ; .....it looked not easy…
With this stuff we can get object-serializer.
Try to store keyreleased state into your own variable and use it inside of loop logic.
Next loop step keys should be flushed by monkey’s event system.
Better via ted2go github repo issues.
Or here on forum if dislike issues.
Nice to hear!
(I checked, there is no ‘numlock-bug’ in ted2go code.)
Don’t know… Only wrong thing I know is sending numlock-converted key into core mojox.TextView.
For me it looks so difficult to use import-alias.
Instead of that we can create a file std.default.monkey2 and fill it:
Monkey1234Import <std>Using std.coreUsing std.collections' Using std.[other sub modules]And import this file in our project via #Import “std.default”.
You explore one way:
- include custom submodules of std
- using std.. (two dots after std).
The other way is to use
- import <std>
- and using custom submodules, like this
- Using std.core
- Using std.filesystem
- etc….
But I don’t know will the output be optimized this way.
Can you try ?
Small – n – cool changes:
- “Reload All” action for external changes chicking
- “Save All” and “Discard All” actions in Save file dialog – showed on Quit and on Close few tabs.
There is no smart checking for a few changed files, so you will see saveAll / discardAll even for one file. I think it’s not a problem.
Attachments:
I will add.
New stuff in a repo!
- (!) Now call “Force stop” before build / buildAndRun. Is it OK for everyone?
- (!) Project view – added simple files filter (see project.json); double-click to expand folders; little faster scroll.
- (!) Autocomplete – improved ‘self’, added ‘super’.
- Autocomplete – improved insertion – brackets for methods and full description if there is “method” keyword before – try to override method and you’ll see the power of that.
- Fixed text insertion – if text was copied from codeview (prepared on copy/cut).
- Improved parser checking for some entity types.
- Synced Sources tree with current line.
- Added new icon for field-is-func members.
- Display brackets [] for arrays.
- Colors by theme – for Autocomplete list and Sources tree.
- Merged ted2 (+smooth theme, some fixes)
Files filter – see the file ‘ted2go/project.json’.
There is no regexp, the logic is:
- *filter – starts with star – check text.StartsWith( filter )
- filter* – ends with star – check text.EndsWith( filter )
- *filter* – starts and ends – check text.Find( filter )
- w/o stars – check equals, text = filter
I have more attentively looked at your code.
You want to extend Container with template type. So my previous answer is wrong.
The ideal solution to all this would be for Mark to implement Mixins (or Traits, or whatever you want to call them).
It looks like the only way.:)
December 1, 2016 at 12:07 pm in reply to: Global Const initialized from monkey.math.Pi calculation #5531Added to issues https://github.com/blitz-research/monkey2/issues/123
There is no docs for this yet (I never seen). I hope it will be added later.
You can find a few topics on this forum by request ‘Where T’.
“Where” in mx2 works like in c#, google “c# where” for more info.
I don’t use T directly inside Container, no, but used as I have, it allows me to turn any class into a Container without having to rewrite the Container methods. It allows me to use Container as a mixin with any other class. The key point is that in my example Frame extends both Container and Widget – it inherits all methods from both classes. I guess you could call it multiple inheritance but that has a bad reputation so it’s a term I prefer to avoid.
It looks like that solution for you is using
Monkey1Class Container<I> Where I Implements IWidgetSo you can add any widget into container (they all implement IWidget), and you also can add frames into container (it implements IWidget too).
Is it possible and useful to anyone to add support for likes in the forum?
For me it’s useful. Often I simply want to Like post but don’t want to create post.
-
AuthorPosts

