Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
A Toy Soldier
@iamthecarisma_twitter
No problem the PR will wait on you
A Toy Soldier
@iamthecarisma_twitter
the variadic parameter can now be any identifier e.g p1..., 'var...' just as @appcypher suggessted
I ll send a PR to the main REPO for review
A Toy Soldier
@iamthecarisma_twitter
PR for reflection and meta programming,
simple-lang/simple#50
By merging this PR you will be able to install modules directly from github repo similar to go get ... e.g
 $ modular install Youngestdev/NgBanks
Abdulazeez Abdulazeez Adeshina
@Youngestdev
Did you know the Variadic parameter takes 0-Inf arg (
That's cool and will be useful in modules like List, Map etc
I fixed the Map module to work effectively and use the __OBJECT style.
A Toy Soldier
@iamthecarisma_twitter
Yes it accept zero arg so having it in a costructor as parameter is better and can be used for method overloading
A Toy Soldier
@iamthecarisma_twitter
Anytime you online here let talk on how modular currenlty works
Abdulazeez Abdulazeez Adeshina
@Youngestdev
Heyo
A Toy Soldier
@iamthecarisma_twitter
Hello
A Toy Soldier
@iamthecarisma_twitter
Hello everyone I am working heavily on the module. I need opinion on this idea of mine.
simple-lang parameters are passed by reference which means that object passed as argument to block remain the same and all the operation perform on the object will reflect in the actual block e.g
call simple.utilities.Console

object = new TestClass { Name = "Ade" }
treat(object)
stdout.println(object.Name) #prints Wale

block treat(obj)
    obj.Name = "Wale"

class TestClass Name = ""
A Toy Soldier
@iamthecarisma_twitter
I am thinking we should change that behaviour such that what will be sent to the block will be a copy of the original object such that the behaviour will be
call simple.utilities.Console

object = new TestClass { Name = "Ade" }
treat(object)
stdout.println(object.Name) #prints Ade

block treat(obj)
    obj.Name = "Wale"

class TestClass Name = ""
Then what will always go the block and methods by default will be a copy in this way actual object will remain safe for implementation and the block won't break it
Then optionally we can provide developer with C style of passing object by reference such that the actual object will enter the block we can use the ampersand sign ampersand for passing by reference such that behaviour will be like
call simple.utilities.Console

object = new TestClass { Name = "Ade" }
treat(object)
stdout.println(object.Name) #prints Ade
treat(&object)
stdout.println(object.Name) #prints Wale

block treat(obj)
    obj.Name = "Wale"

class TestClass Name = ""
the & before the arg will make the actual object enter the block and not a copy
Abdulazeez Abdulazeez Adeshina
@Youngestdev
Well, it's cool tho. I don't think I have experienced this ( I haven't tried this ).
Before implementing, what are the pros and cons ?
If I understand something from this block of code. The treat block value overwrites the previous value ? It looks fishy actually. The obj isn't a class ? So how does it get to work with obj.Name or am o missing something ?
A Toy Soldier
@iamthecarisma_twitter
Pros :
  • actual object remain safe
  • since an object is going to perform an op in a block it should not break the object
  • understandable code
  • yen yen yen
    Cons:
    • Developer might forgot to put thr & symbol which will not make block do unexpected behaviour
Abdulazeez Abdulazeez Adeshina
@Youngestdev
Oh, I get the obj.Name logic.
One question, what basically is the setback of the current method ?
A Toy Soldier
@iamthecarisma_twitter

If I understand something from this block of code. The treat block value overwrites the previous value ? It looks fishy actually. The obj isn't a class ? So how does it get to work with obj.Name or am o missing something ?

yes by default block can change and override the object value which can be confusing

The setback of the current method here is that it passed by reference that means the object can be destroyed unknowingly by a block e.g
call simple.utilities.Console

object = new TestClass { Name = "Ade" }
treat(object)
stdout.println(object.Name) #Throws an error

block treat(obj)
    obj = null

class TestClass Name = ""
meanwhile after the new implementation it will only destroy it for itself and the original remain the same except the objec is passsed with the ampsand e.g treat(&object)
Abdulazeez Abdulazeez Adeshina
@Youngestdev
Introducing the ampersand might look toxic .
A Toy Soldier
@iamthecarisma_twitter
In what way
Abdulazeez Abdulazeez Adeshina
@Youngestdev
Most dev won't understand the use.
Between, why can block outside the class change values? That's odd.
A Toy Soldier
@iamthecarisma_twitter
They ll definitly learn, and actually most developer treat arguments in methods as if it won't affect the one outside
Abdulazeez Abdulazeez Adeshina
@Youngestdev
Hmm. There should be another way round. I wouldn't wanna suggest limiting the changes to block values to only the blocks setters and getters but that's also an idea.
Let's wait for other inputs from @/all
A Toy Soldier
@iamthecarisma_twitter

Between, why can block outside the class change values? That's odd.

It the normal standard of most high level languages, java, python e.t.c

By the way am working heavily on graphics module and fulltick by early next month we l have a small REPL and terminal for simple-lang on android to run and debug simple-lang on the fly
Abdulazeez Abdulazeez Adeshina
@Youngestdev
Hmmmm. Sounds nice.
Any update on the modular ?
A Toy Soldier
@iamthecarisma_twitter
Am waiting for you guys input on the ampersand & implementation
appcypher
@appcypher
I'm afraid you are adding a learning curve to the language if you make user to specify refs different from vals.
Everything (except primitive types maybe) should be passed by reference by default, because:
  • that's what is most dynamic languages (ruby, python, javascript, even java) and that's what users will expect
  • it is efficient both performance-wise and memory-consumption-wise
  • users can always use a .clone() or sth similar if they want a copy of the object
A Toy Soldier
@iamthecarisma_twitter
alright
A Toy Soldier
@iamthecarisma_twitter
Hello i am getting rid of the 'self' keyword and leaving only 'this' the two are pretty much the same except they clash sometimes so am removing 'self'
Abdulazeez Abdulazeez Adeshina
@Youngestdev
ideally the both of them are supposed to be working different I think we did not get the context in which they're supposed to work you know so I may be before moving actually I want you to digress into both of them you know so you can actually know what's going to happen
A Toy Soldier
@iamthecarisma_twitter
self is the actual or active object while this is used when the object scope changes, am keeping it, i ll write a blog to clarify the different
A Toy Soldier
@iamthecarisma_twitter
We need to follow same patter of code anyone building core module for the simple-lang should use the bracket instead of end for statements and no need to terminate the block with and end
New Module Standard
class Module : Object

    block Module()
         if true {

         }
A Toy Soldier
@iamthecarisma_twitter
It of great advantage to inherit object as it now has some very useful blocks from classes. Such as toString, modulename
no need to explicily declare OBJECT_NAME and OBJECT the object name and absolute name is stored in the Object class
e.g when a class inherit Object this blocks are loaded
@ourClass.classname() #will return the name from reflection e.g List
@ourClass.modulename() #will return the module name from reflection e.g simple.core
@ourClass.absolutename() #will return the absolute name from reflection e.g simple.core.List
and also for whatever you are printing to console kindly don't use @ and display use this instead
call simple.utilities.Console

stdout.println(yourobject) #to print an object to standard output
stderr.println(yourobject) #to print an object to standard error stream
A Toy Soldier
@iamthecarisma_twitter

using the blocks from Console will even allow any kind of object to be printed in a very pretty manner. If the object does not inherit 'Object' and does not have it toString() block you can send true as extra parameter to create a printable string from the object e.g

test = new Test
stdout.println(test) #prints => (this object cannot be printed)
stdout.println(test,true) #prints => [module.Test:x=10,y=10] 
class Test
   x = 10
   y = 10

stdout.println(test,true) actually created a printable string from the object

I ll develop the Console module more and blog about it
Sonkeng Maldini
@sdmg15
Hello guys ! A new contributor setting up :smile: