It is currently Thu Jul 18, 2019 2:49 pm

All times are UTC + 1 hour




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: Flexible Operators working within types
PostPosted: Mon Apr 29, 2019 4:48 am 
Offline
User
User

Joined: Mon Feb 26, 2018 3:14 am
Posts: 11
This is a simplified version of it but, mostly a wildly interesting thing that could be added. :)
Giving us more control over the operators. I am sure it could be much more advanced than what i am showing.

Code:

Structure Numbers
  one.i
  two.i
  If Operator '+'
      new(one.i) =  old(one.i) + current(one.i)
      new(two.i) =  old(two.i) + current(two.i)
  EndIf
EndStructure

test1.Numbers
test1\one = 5
test1\two = 7

test2.Numbers = test1
test3.Numbers = test1 + test2
test4.Numbers = test1 + test2 + test3

; Results for test3 and test4
;------------------
;  test3\one = 10
;  test3\two = 14
;-------------------
;  test4\one = 20
;  test4\two = 24
;------------------


Last edited by deathmx on Thu May 16, 2019 3:51 pm, edited 2 times in total.

Top
 Profile  
Reply with quote  
 Post subject: Re: Flexible Operators working within types
PostPosted: Wed May 15, 2019 12:22 pm 
Offline
Always Here
Always Here

Joined: Fri Oct 23, 2009 2:33 am
Posts: 5818
Location: Wales, UK
Hi deathmx

I'm not so sure. I don't see an advantage in having an equation inside a Structure like that - what I see is code that ends up being very difficult to debug.

_________________
IdeasVacuum
If it sounds simple, you have not grasped the complexity.


Top
 Profile  
Reply with quote  
 Post subject: Re: Flexible Operators working within types
PostPosted: Thu May 16, 2019 2:51 am 
Offline
User
User

Joined: Mon Feb 26, 2018 3:14 am
Posts: 11
This is just an example and probably not the best way. I am sure this sort of thing could be done in many different ways that would make more sense lol.

I was just looking mostly for a way to get more flexibility/controls over operators.


Top
 Profile  
Reply with quote  
 Post subject: Re: Flexible Operators working within types
PostPosted: Thu May 16, 2019 9:01 am 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Sun Jun 22, 2003 7:43 pm
Posts: 391
Location: Germany, Saarbrücken
The advantage comes with more complicated stuff like vectors or complex numbers or even quaternions.

_________________
Electronics, Crazy & Interesting Stuff, all that with text, image and sound? Click here!

The english grammar is freeware, you can use it freely - But it's not Open Source, i.e. you can not change it or publish it in altered way.


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye