Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Arrow functions revisited #168

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

msisaifu
Copy link
Contributor

No description provided.


It's in the very spirit of JavaScript to create a function and pass it somewhere.
অনেক সময় আমাদের কোন ফাংশন লিখ তা অন্য কোন কন্টেক্সে ব্যবহার করতে হয়।
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please change: অনেক সময় আমাদের কোন ফাংশন লিখ তা অন্য কোন কন্টেক্সে ব্যবহার করতে হয়।
to অনেক সময় আমাদের কোন একটি ফাংশন লিখে তা অন্য আরেকটি ফাংশনের কন্টেক্সে ব্যবহার করতে হয়।


And in such functions we usually don't want to leave the current context. That's where arrow functions come in handy.
এবং এসব ক্ষেত্রে আমরা ফাংশনটিকে কারেন্ট কন্টেক্স কল করতে চাই। এক্ষেত্রে অ্যারো ফাংশন আমাদের অনেক সুবিধা দেয়।
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please change: এবং এসব ক্ষেত্রে আমরা ফাংশনটিকে কারেন্ট কন্টেক্স কল করতে চাই। এক্ষেত্রে অ্যারো ফাংশন আমাদের অনেক সুবিধা দেয়।
To : এবং এসব ক্ষেত্রে আমরা ফাংশনটিকে কারেন্ট কন্টেক্সে কল করতে চাই। এক্ষেত্রে অ্যারো ফাংশন আমাদের অনেক সুবিধা দেয়।


```warn header="Arrow functions can't run with `new`"
Not having `this` naturally means another limitation: arrow functions can't be used as constructors. They can't be called with `new`.
```warn header="`new` এ সাথে অ্যারো ফাংশন রান করে না"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please change: new এ সাথে অ্যারো ফাংশন রান করে না"
To : new এর সাথে অ্যারো ফাংশন রান করে না"

```

```smart header="Arrow functions VS bind"
There's a subtle difference between an arrow function `=>` and a regular function called with `.bind(this)`:
অ্যারো ফাংশন `=>` এবং ্রেগুলার ফাংশন `.bind(this)` এর মাঝে একটি পার্থক্য আছে:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please change: অ্যারো ফাংশন => এবং ্রেগুলার ফাংশন .bind(this) এর মাঝে একটি পার্থক্য আছে
To: অ্যারো ফাংশন => এবং রেগুলার ফাংশন .bind(this) এর মাঝে একটি পার্থক্য আছে

That's great for decorators, when we need to forward a call with the current `this` and `arguments`.

For instance, `defer(f, ms)` gets a function and returns a wrapper around it that delays the call by `ms` milliseconds:
ডেকোরেটার্সের জন্য এটি দারুণ, যখন আমাদের `this` এবং `arguments` এর সাহায্যে একটি ফরওয়ার্ড কল করতে হয়।
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please dont mention decorators as ডেকোরেটার্স rather use ডেকোরেটর ফাংশন or in plurals ডেকোরেটর ফাংশন গুলোর

@@ -99,7 +98,7 @@ let sayHiDeferred = defer(sayHi, 2000);
sayHiDeferred("John"); // Hello, John after 2 seconds
```

The same without an arrow function would look like:
অ্যারো ফাংশন ছাড়া ডেকোরেটার্সটি দেখতে এমন হত:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

update this line following the last comment regarding decorators

@@ -112,15 +111,15 @@ function defer(f, ms) {
}
```

Here we had to create additional variables `args` and `ctx` so that the function inside `setTimeout` could take them.
এখানে আমাদের `setTimeout` ফাংশনের কন্টেক্সট এর জন্য আলাদা দুটি `args` এবং `ctx` ভ্যারিয়েবল লাগছে।
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please change to: এখানে আমাদের অতিরিক্ত ভেরিয়েবল args এবং ctx তৈরি করতে হয়েছিল যাতে setTimeout-এর ভিতরের ফাংশন সেগুলোকে ব্যবহার পারে।


That's because they are meant for short pieces of code that do not have their own "context", but rather work in the current one. And they really shine in that use case.
এটি দ্বারা বোঝায় অ্যারো ফাংশনের নিজস্ব কোন "context" নাই, তবে "current context" এর সাথে কাজ করে। এধরণের ক্ষেত্রে এরা আসলেই সুবিধাজনক।
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please change to: অ্যারো ফাংশন মূলত কোডের ছোট ছোট টুকরো। যা নির্দিষ্ট একটি কাজ করতে পারে। যেগুলির নিজস্ব context নেই, বরং current context এ কাজ করে।

Copy link
Member

@jaamaalxyz jaamaalxyz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please follow the guidelines and resolve all the change requests. appreciate your hard work.

@javascript-translate-bot

Please make the requested changes. After it, add a comment "/done".
Then I'll ask for a new review 👻

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants