[0.9.0] Added limited table support to Channel:push?

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
User avatar
Azhukar
Party member
Posts: 478
Joined: Fri Oct 26, 2012 11:54 am

[0.9.0] Added limited table support to Channel:push?

Post by Azhukar »

What does limited table support mean in regards to capabilities?
User avatar
slime
Solid Snayke
Posts: 3144
Joined: Mon Aug 23, 2010 6:45 am
Location: Nova Scotia, Canada
Contact:

Re: [0.9.0] Added limited table support to Channel:push?

Post by slime »

Simple tables can be copied (not referenced) between threads.
Keys and values which are numbers, strings, booleans, or references to love objects will be copied. Functions and tables inside tables won't.
User avatar
Azhukar
Party member
Posts: 478
Joined: Fri Oct 26, 2012 11:54 am

Re: [0.9.0] Added limited table support to Channel:push?

Post by Azhukar »

slime wrote:Simple tables can be copied (not referenced) between threads.
Keys and values which are numbers, strings, booleans, or references to love objects will be copied. Functions and tables inside tables won't.
Why not use recursion on tables inside tables and assume the user will treat it gently, i.e. not use table loops or other shenanigans?

Other than that it sounds awesome :awesome:
User avatar
Kingdaro
Party member
Posts: 395
Joined: Sun Jul 18, 2010 3:08 am

Re: [0.9.0] Added limited table support to Channel:push?

Post by Kingdaro »

In the event that some asshole decides to do something like this:

Code: Select all

tab = {}
tab[tab] = tab
That'll be a nice loop you can sort yourself out of there.

EDIT: I'm joking, for the record.
Last edited by Kingdaro on Sat Jul 20, 2013 7:25 am, edited 1 time in total.
User avatar
raidho36
Party member
Posts: 2063
Joined: Mon Jun 17, 2013 12:00 pm

Re: [0.9.0] Added limited table support to Channel:push?

Post by raidho36 »

Why not just let those assholes deal with them being assholes to themselves? Regular people don't do this kind of crap and therefore won't encounter looped references in tables. I mean, who cares about those retards who do that. Besides, you can make some degree of foolproofing (though that goes against Lua's philosophy), but idiotproofing is meaningless: idiot can always find a way to break it.

Like I said, why bothering over getting invalid code to run if you don't expect it to run in the first place?
User avatar
T-Bone
Inner party member
Posts: 1492
Joined: Thu Jun 09, 2011 9:03 am

Re: [0.9.0] Added limited table support to Channel:push?

Post by T-Bone »

raidho36 wrote:Why not just let those assholes deal with them being assholes to themselves? Regular people don't do this kind of crap and therefore won't encounter looped references in tables. I mean, who cares about those retards who do that. Besides, you can make some degree of foolproofing (though that goes against Lua's philosophy), but idiotproofing is meaningless: idiot can always find a way to break it.

Like I said, why bothering over getting invalid code to run if you don't expect it to run in the first place?
But having storing a table within itself is not invalid code in any other LÖVE context, so why should it be one here?

I'm actually sort of against any table support that isn't complete, mostly because the rules it places on those tables has to be a bit arbitrary, which can be confusing. It doesn't feel very "clean".
User avatar
raidho36
Party member
Posts: 2063
Joined: Mon Jun 17, 2013 12:00 pm

Re: [0.9.0] Added limited table support to Channel:push?

Post by raidho36 »

But having storing a table within itself is not invalid code in any other LÖVE context, so why should it be one here?
Because that's how it works? Really though, tables should be referenced rather than copied.
It doesn't feel very "clean".
Then think of them as arrays of data rather than actually a tables.
User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

Re: [0.9.0] Added limited table support to Channel:push?

Post by Robin »

It's trivial to write a deepcopy that deals with cycles in Lua. It might not be that simple to write an implementation that does the same trick across threads.

Who knows, maybe full table support to Channel:push for 0.9.1? I might implement it myself*, and finally contribute something substantial to el engine.

* Hah, as if!
Help us help you: attach a .love.
User avatar
Xgoff
Party member
Posts: 211
Joined: Fri Nov 19, 2010 4:20 am

Re: [0.9.0] Added limited table support to Channel:push?

Post by Xgoff »

raidho36 wrote:Why not just let those assholes deal with them being assholes to themselves? Regular people don't do this kind of crap and therefore won't encounter looped references in tables. I mean, who cares about those retards who do that.

Code: Select all

_G._G

;)
User avatar
raidho36
Party member
Posts: 2063
Joined: Mon Jun 17, 2013 12:00 pm

Re: [0.9.0] Added limited table support to Channel:push?

Post by raidho36 »

Good one, Xgoff. :3 Not that anyone would pass root table to the thread, which would mean copying entire thing minus locals.
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest