[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [ease-dev] Some questions of EASE
|
I have another perspective coming from the Python background and not
being all that familiar with Javascript.
I am personally not a fan of loadModule() putting lots and lots of
symbols in my namespace. I would love to see the option of
loadModule() returning an object that had all the module methods on
it, perhaps with optional arguments that specified which methods (or
all) to add to my namespace? Then loadModule() becomes synonymous with
Python's import statement.
Does that fit in with how Javascript is used?
Jonah
~~~
Jonah Graham
Kichwa Coders Ltd.
www.kichwacoders.com
On 12 May 2016 at 10:25, Trig Chen <trigchen@xxxxxxxxx> wrote:
> Got response from Nashorn development maillist by Sundararajan
> Athijegannathan:
>
> Object.defineProperty function [1], [2] can be make properties non-writable
> and non-configurable (i.e., can't be written, can't be
> deleted or configured to make it writable again etc.)
> For example, the following
>
> Object.defineProperty(this, "quit", { writable: false,configurable:
> false })
>
> will make quit function non-writable and non-configurable. You can do the
> same for all builtin properties of global object just before
> evaluating any other code:
>
> (function() {
> var keys = Object.getOwnPropertyNames(this)
> for (var k in keys) {
> Object.defineProperty(this, keys[k], { writable: false,
> configurable: false })
> }
> })()
>
> quit = 4
> print(typeof quit)
> print(quit)
>
> Java = "hello"
> print(typeof Java)
> print(Java)
>
> [1]
> https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/defineProperty
> [2] http://www.ecma-international.org/ecma-262/5.1/#sec-15.2.3.6
>
>
> Can this be applied in EASE?
>
> Best regards,
>
> Trig
>
> 2016-05-09 1:54 GMT+08:00 Christian Pontesegger
> <christian.pontesegger@xxxxxx>:
>>
>> Hi,
>>
>> there is no way we can prevent scripts from redefining existing functions
>> and variables. you might reload a module which will redefine all its
>> functions (and potentially overwrite same variables defined by the user
>> before).
>> Name conflicts between modules may happen. In some cases they are even
>> wanted. My advice is to use function names that are very specific and
>> therefore unlikely to be overwritten. Programmers then might want to define
>> alias commands that are shorter to type and easier to remember for users.
>>
>> eg
>>
>> @WrapToScript(alias="collapse")
>> public void collapseProjectExplorerTree() {}
>>
>>
>> Auto completion for the shell and and the JS editor are provided to some
>> extent.
>>
>> cheers
>> Christian
>>
>>
>> On 05/08/2016 06:18 AM, Trig Chen wrote:
>>
>> Hi all,
>>
>> I just heard of EASE yesterday. EASE seems the right scripting enviroment
>> I'm looking for.
>> There are some question I wonder.
>>
>> 1. How to avoid script function to be redefined or overwritten?
>> If user types "var wrap=1" in mistakes, the wrap function is
>> redefined and can't be reverted.
>>
>> 2. How to avoid the same name conflicts between modules?
>>
>> 3. Does the script input textbox have auto completion?
>>
>>
>> Best regards,
>>
>> Trig
>>
>>
>> _______________________________________________
>> ease-dev mailing list
>> ease-dev@xxxxxxxxxxx
>> To change your delivery options, retrieve your password, or unsubscribe
>> from this list, visit
>> https://dev.eclipse.org/mailman/listinfo/ease-dev
>>
>>
>>
>> _______________________________________________
>> ease-dev mailing list
>> ease-dev@xxxxxxxxxxx
>> To change your delivery options, retrieve your password, or unsubscribe
>> from this list, visit
>> https://dev.eclipse.org/mailman/listinfo/ease-dev
>
>
>
> _______________________________________________
> ease-dev mailing list
> ease-dev@xxxxxxxxxxx
> To change your delivery options, retrieve your password, or unsubscribe from
> this list, visit
> https://dev.eclipse.org/mailman/listinfo/ease-dev