Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
include и this.$super
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  4 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Vic Khomyackov  
View profile   Translate to Translated (View Original)
 More options Aug 10 2012, 3:42 am
From: Vic Khomyackov <vkhomyac...@gmail.com>
Date: Fri, 10 Aug 2012 00:42:59 -0700 (PDT)
Local: Fri, Aug 10 2012 3:42 am
Subject: include и this.$super

Здравствуйте! У меня есть такой вот вопрос про наследование и перекрытие
методов:

Допустим, есть класс-родитель ParentClass, и его потомок ChildClass, и в
обоих есть реализация метода initialize, но с разными наборами аргументов.
Внутри ChildClass#initialize this.$super будет указывать
на ParentClass#initialize, как и было задумано. Теперь при включении модуля
в ChildClass с помощью SomeClass.include({initialize: function(){}})
в ChildClass#initialize this.$super будет указывать на предыдущую
реализацию (которая кроме как через this.$super больше никак не видна).

Собственно вопрос в том, что предыдущая реализация initialize мне никак не
нужна - я хочу полностью её заменить, и хочу
вызывать ParentClass#initialize, а он просто так уже не доступен. Что
делать? Заменять initialize без помощи include()?

И более общий вопрос: получается, что поведение this.$super зависит от
порядка включения модулей, то есть если есть два модуля с одинаково
названным методом, и такой же метод в классе-предке, но с другой сигнатурой
(другим набором аргументов), то в зависимости от порядка включения модулей
в класс-потомок в первом из модулей this.$super будет указывать на метод
класса-предка (с другой сигнатурой), а во втором - на метод первого модуля
(с той же сигнатурой). Как тут разобраться?


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Nikolay Nemshilov  
View profile   Translate to Translated (View Original)
 More options Aug 11 2012, 12:34 am
From: Nikolay Nemshilov <nemshi...@gmail.com>
Date: Sat, 11 Aug 2012 11:34:07 +0700
Local: Sat, Aug 11 2012 12:34 am
Subject: Re: include и this.$super

Привет,

В этом случае всегда можно вызвать родительский класс через его прототип,

ParentClass.prototype.initialize.call(this, arg, arg,... )


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Vic Khomyackov  
View profile   Translate to Translated (View Original)
 More options Aug 13 2012, 7:48 am
From: Vic Khomyackov <vkhomyac...@gmail.com>
Date: Mon, 13 Aug 2012 04:48:37 -0700 (PDT)
Local: Mon, Aug 13 2012 7:48 am
Subject: Re: include и this.$super

> ParentClass.prototype.initialize.call(this, arg, arg,... )

Да, я это понимаю, но проблема с двусмысленностью this.$super всё равно
остаётся?

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Nikolay Nemshilov  
View profile   Translate to Translated (View Original)
 More options Aug 13 2012, 8:16 am
From: Nikolay Nemshilov <nemshi...@gmail.com>
Date: Mon, 13 Aug 2012 19:16:04 +0700
Local: Mon, Aug 13 2012 8:16 am
Subject: Re: include и this.$super

Мм. Нет никакой двусмысленности,  $super всегда вызывает предыдущий метод.
On Aug 13, 2012 6:48 PM, "Vic Khomyackov" <vkhomyac...@gmail.com> wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »