Thai, I'm still poking around at JavaScript things and did a little testing on function declarations vs function expressions. Seems Firefox is faster with function expressions by quite a bit at parse time. For reference see http://jsperf.com/mfer-function-types.
I'm not suggesting what we do. I'm just sharing a data point I found surprising. I'm curious about the process for proposing changes to https://wiki.openstack.org/wiki/Horizon/Javascript. Is there any process? On Wed, Jan 14, 2015 at 1:15 PM, Thai Q Tran <[email protected]> wrote: > > It was definitely an interesting the read, I never really noticed the > subtle difference. Since then I have also read a few other thoughts on it. > For me, function declarations can get convoluted very fast if not use > correctly. > Surely, you should never define functions inside of an if statement, and > quite confusing to do it after a return statement. > But they do have their uses when used correctly. > I think it ultimately depends on what you are trying to do and whether it > make sense to use declarations vs expressions. > As long as people understand the difference, and take it case-by-case, its > not really something I'm going to mull over too much. > > -----Matthew Farina <[email protected]> wrote: ----- > To: "OpenStack Development Mailing List (not for usage questions)" < > [email protected]> > From: Matthew Farina <[email protected]> > Date: 01/14/2015 07:04AM > Subject: [openstack-dev] [horizon] function expressions vs function > declarations in JavaScript > > > JavaScript has multiple ways to deal with functions. There are function > declarations and function expressions (and named function expressions). > > In looking at some reviews and the current code I found some > inconsistencies which leads me to ask, is there any guidance for handling > this in Horizon? I noticed no documentation in > https://wiki.openstack.org/wiki/Horizon/Javascript. > > Thanks, > Matt > > > __________________________________________________________________________ > OpenStack Development Mailing List (not for usage questions) > Unsubscribe: [email protected]?subject:unsubscribe > http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev > > __________________________________________________________________________ > OpenStack Development Mailing List (not for usage questions) > Unsubscribe: [email protected]?subject:unsubscribe > http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev > >
__________________________________________________________________________ OpenStack Development Mailing List (not for usage questions) Unsubscribe: [email protected]?subject:unsubscribe http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
