[openstack-dev] [horizon] function expressions vs function declarations in JavaScript

Aaron Sahlin asahlin at linux.vnet.ibm.com
Thu Jan 15 17:45:00 UTC 2015


Just to expand a bit on Thai's response..   Make the changes to 
horizon/doc/source/contributing.rst and submit a patch, once that gets 
approval then
go update the wiki.

On 1/14/2015 3:49 PM, Thai Q Tran wrote:
>
> Wow, that IS interesting. No process required, just modify 
> /horizon/doc/source/contributing.rst and submit a patch.
>
> -----Matthew Farina <matt at mattfarina.com> wrote: -----
> To: "OpenStack Development Mailing List (not for usage questions)" 
> <openstack-dev at lists.openstack.org>
> From: Matthew Farina <matt at mattfarina.com>
> Date: 01/14/2015 12:20PM
> Subject: Re: [openstack-dev] [horizon] function expressions vs 
> function declarations in JavaScript
>
> 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 <tqtran at us.ibm.com 
> <mailto:tqtran at us.ibm.com>> 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 <matt at mattfarina.com
>     <mailto:matt at mattfarina.com>> wrote: -----
>     To: "OpenStack Development Mailing List (not for usage questions)"
>     <openstack-dev at lists.openstack.org
>     <mailto:openstack-dev at lists.openstack.org>>
>     From: Matthew Farina <matt at mattfarina.com
>     <mailto:matt at mattfarina.com>>
>     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:
>     OpenStack-dev-request at lists.openstack.org?subject:unsubscribe
>     <http://OpenStack-dev-request@lists.openstack.org?subject:unsubscribe>
>     http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
>
>     __________________________________________________________________________
>     OpenStack Development Mailing List (not for usage questions)
>     Unsubscribe:
>     OpenStack-dev-request at lists.openstack.org?subject:unsubscribe
>     <http://OpenStack-dev-request@lists.openstack.org?subject:unsubscribe>
>     http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
>
>
> __________________________________________________________________________
> OpenStack Development Mailing List (not for usage questions)
> Unsubscribe: OpenStack-dev-request at lists.openstack.org?subject:unsubscribe
> http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
>
>
> __________________________________________________________________________
> OpenStack Development Mailing List (not for usage questions)
> Unsubscribe: OpenStack-dev-request at lists.openstack.org?subject:unsubscribe
> http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstack.org/pipermail/openstack-dev/attachments/20150115/46b98ebc/attachment.html>


More information about the OpenStack-dev mailing list