From: RobG on
On Nov 26, 9:06 pm, "optimistx" <optimi...(a)hotmail.com> wrote:
[...]
> I tried to write a general little js-program with appropriate
> principles proclaimed here and elsewhere: inheritance,
> encapsulation, oop , reuse, short and compact, easy to read
> (and write).

If a non-trivial program meets some or most of those requirements, it
will only be easy to write if you are particularly gifted and
knowledgable.

>  Hundreds of lines of code, soon thousands. Ugly.
>  Too complicated. `Lots of things to improve or redesign.

You likely have too many competing concerns. Define your goals within
parameters that you are reasonably certain you can acheive, then work
to achieve them. As you get better at development, your goals will get
higher.


--
Rob
From: optimistx on
RobG wrote:
> On Nov 26, 9:06 pm, "optimistx" <optimi...(a)hotmail.com> wrote:
> [...]
....
> You likely have too many competing concerns. Define your goals within
> parameters that you are reasonably certain you can acheive, then work
> to achieve them. As you get better at development, your goals will get
> higher.
You may be right.

As an example I mean something like this code of Peter Michaux:
http://peter.michaux.ca/articles/how-i-write-javascript-widgets
but his example is about a logger. Logging is a bit simpler task.
I had written my own logger earlier without seeing Peter's, and
I was pleased and proud to see some similarities in the code :)
(mine did not use any libraries and could be created before the
dom is ready to report things during page load).

I admire Peter Michaux's writings and openmindednes. He
seems to be honest about his mistakes and does not pretend to
something else, and can affort to be kind. Another js-idol for me,
Douglas Cornford, dares to confess his mistakes,
too. More people resembling them , kind and capable of
explaining things pedagocially well?



From: Garrett Smith on
Richard Cornford wrote:
> On Nov 26, 11:06 am, optimistx wrote:

[snip]
>
> Assigning to the result of a function call is not something that you
> should expect to get away with in javascript (the language's syntax
> allows it, but only host methods are allowed to return something that
> can be assigned to).
>

I am aware of the provision, but unaware of any host methods that return
a Reference. Do you know of any?
--
Garrett
comp.lang.javascript FAQ: http://jibbering.com/faq/
From: Richard Cornford on
Garrett Smith wrote:
> Richard Cornford wrote:
>> On Nov 26, 11:06 am, optimistx wrote:
> [snip]
>> Assigning to the result of a function call is not something that
>> you should expect to get away with in javascript (the language's
>> syntax allows it, but only host methods are allowed to return
>> something that can be assigned to).
>>
>
> I am aware of the provision, but unaware of any host methods that
> return a Reference. Do you know of any?

None have been brought to my attention to date, but as assigning to the
result of a function call is something that I don't ever expect to work,
it is something that I have not tried on sufficient host method results
to be able to rule out the possibility that some do return Reference
types. As most ECMA 262 algorithms call GetValue on their input any
Reference types that were returned by host methods would tend to be
indistinguishable from values in almost all non-assignment contexts.

Richard.

From: kangax on
David Mark wrote:
> On Nov 23, 4:16 am, wilq <wil...(a)gmail.com> wrote:
>> On Nov 21, 12:32 pm, "optimistx" <optimi...(a)hotmail.com> wrote:
[...]
>> 2. IMHO, and after doing some test on different environment I have to
>> say that from performance side its adviceable to put everything in
>> simple HTML. I never tried that, but you could even put some
>> "template" elements in HTML with "display:none" in CSS, and then clone
>> them if needed from JS side.
>
> No. You can't hide "templates" in your markup. Some users will end
> up seeing (or hearing) them.

Yep. Unfortunately, some of the screen readers (less popular ones,
though) pronounce even display:none content. You can still hide things
with comments.

[...]

--
kangax