الأربعاء، 31 أغسطس 2011

Graduation project themes and ideas - 2010

In 2010 I suggested the idea of having multiple graduation projects with a common topic or 'theme'. My hope from this was to:
  • Give students the feelings that their projects are part of a larger goal
  • Give opportunity for different teams to cooperate and share e.g research papers they found on the topic
  • Possibly plant the seed of 'research departments' in FCIS, where multiple MS.c or Ph.D researchers work on common topics instead of each doing an independent topic.
That year I gave a presentation outlining two themes: Arabic natural language processing and Pen computing , and giving a lot of ideas for each theme (and some outside the themes).

Here's the presentation slides, in case they might be useful: Themes for Graduation projects - 2010

الأحد، 21 أغسطس 2011

How Kalimat produces EXE files


Everyone tells me Kalimat is a toy language since it doesn't produce .exe files.

At first, I didn't pay attention since my main goal was teaching children programming. I mean, does Smallbasic produce exe's? Does Scratch?

But gradually, I changed my mind
  • Many children would feel patronized if they have a perception of being taught with a "kiddy" language, even if the language is actually powerful - if it seems kiddy, that's bad.
  • Being an Arabic-based language means it's under more scrutiny, since a lot of people will have the "Arabs can't make a real language" point of view, and will find any reason to say so
  • There is a real technical need for making .exe files from programs, so that users - kid or adult - can distribute their programs to others.
So started the journey of making executables. I began considering my options:
  1. Generate assembly code or machine code from Kalimat, perhaps using something like LLVM or C--
  2. Generate code in another language like C++ or Go, and use e.g a C++ compiler to create the .exe
  3. Cheat
Cheating sounds good, right? What does that mean exactly? Well, in early versions of Visual Basic (far before VB6 or .Net) the IDE could create exe files, but not exactly the way you know: The file contained a bytecode version of your program, and you had to include a DLL that came with VB and contained an interpreter for this bytecode. All your exe had to do was to load the DLL and tell it: "Here, take this program and run it for me, will you?".

This is also how py2exe works: It bundles your python program and a python interpreter into one package, and that is your executable.

Kalimat has already taken a lot of ideas from Basic and Python, so I decided to go this route and quickly add that feature, and in the long term consider adding the capability of making real, 'respectful' .exe files.

(I do mean 'quickly', it was done in ~ 3 days).

Step 1: Separate SmallVM into its own DLL

The Kalimat IDE and SmallVM (the virtual machine that runs Kalimat programs) were very tightly coupled in the source code. I had to spend some times moving all runtime code from the IDE to the VM, making small changes as I go, and export some VM functions.

Now I have an independent smallvm.dll which exports a function that your programs can send code to execute.

Even better: smallvm.dll does not take Kalimat code, but takes code in the form of its own assembly. That means if you're creating your own programming language you can use it.

Step 2: Generate the "driver" program

Now suppose the user typed this program and wants to create an .exe from it:
اطبع 12
First the Kalimat IDE will generate this assembly:

.method main
pushv 12
callex print
ret
.endmethod
This is good. Now we need a program that does something like this:
#include "smallvm.h"

int main( )
{
char *program =".method main\npushv 12\n\callex print\nret\n.endmethod";
SmallVMRunCode(program);
}
If this program is then made to .exe, then we're done!

Notice that I've simplified a lot of details here. For example the char *program is actually not a direct representation of the program but a base64 encoding of it. Also notice that I could've used a technique called 'binary blobs' to bypass the need for repeatedly compiling C++ code and just use a linker to combine object files.

So far so good, but that means I need to include a C or C++ compiler (or a linker) with Kalimat. On the Linux version of Kalimat that's easy: Just add gcc or g++ as a dependency and the package manager would take care of the job.

On Windows I'd have to manually bundle a compiler. The standard Open Source C++ compiler on Windows is MinGW. Its a little more than 120 megabytes...

Ouch. Remember that Kalimat's download is currently about 5.4 megabytes.

I tried to take only the necessary files in MinGW and include them, but failed. I don't know what little stuff depends on other little stuff.. It might be possible, even easy, but I don't want to keep trying out things aimlessly, and I don't want to study - right now- the structure of the GNU toolchain. Let's find another way.

No problem, I thought: I'll use Google's Go language. The compiler and linker (8g.exe, 8l.exe) are 1.8 megabytes together, and they don't need anything else to work. Excellent! All I need to do is generate a small Go program that calls a function from a C dll.

To do this, I think you use a tool called cgo that's bundled with Go. I tried for some time to use cgo but failed. I didn't spend a long time doing that; maybe I'm too lazy, maybe if I spent a little more time I'd have figured it out, but anyway...

What other languages produce native .exe's these days? I know: Free Pascal.

I'll spoil the surprise for you: this is the current solution. Yup! Good ole' Pascal :)

At first, the generated .pas file looked something like this:
program RunSmallVM;

procedure RunSmallVMCodeBase64(A:PChar;B:PChar);
stdcall ;external 'smallvm.dll';
begin
RunSmallVMCodeBase64('','2e6d657468');
end.
This is good as long as your encoded program is small. Once it gets a little large you find out that traditional Pascal string can't go more than 255 characters. What?

Ok, you can add a compiler directive to make the language use another type of string (AnsiStrings), but string literals maintain the 255 character limit. Sigh :(

No problem: I made the code generator make a series of string concatenations to form the final program form. This would slow down the time from loading the .exe to running the program, but it now works. I can speed things up later, by embedding binary blobs in the .exe or something.

Also I had trouble with base64 encoding of programs: Parts of the SmallVM assembly program are themselves encoded in base64. It seems the encoding in this case messes up. This is what happened with me:

programHeader = encode64(stuff)
program = programHeader + restOfCode
stringToSend = encode64(program)

originalProgram = decode64(stringToSend)

To my surprise, the string originalProgram is not equal to programHeader+restOfCode as expectd, but instead it is equal to stuff+restOfCode. It seems the base64 decoder is too eager to decode anything that seems like base64 characters :(

As a hack I used different functions in the .DLL to send different parts of the program. I'll figure out a proper solution later.

There is a lesson to be learned here: It pays to diversify your knowledge! In order to create an actual useful product, I went through a journey of old and new technology: VB, py2exe, MinGW, Go, and even Pascal. You don't know what knowledge will finally solve the problem.

So it's buggy, it's hacky, it's unstable, but it's there! Kalimat can now generate .exe files! And with a few iterations I hope it works well enough for day to day usage.

الجمعة، 19 أغسطس 2011

Roadmap for Kalimat

What's the whole plan, present and future, for the Kalimat programming language? Here's a rough outline.

These goals are listed roughly from "Immediate future" to "long term", but they are not strictly in order: Some things are done in parallel, some of the 'long term' items have actually started now, the important part here is the ideas, not the order of their execution.

More stable language
  • Make FFI work correctly, fix memory leaks, pointer issues...etc
  • Fix odds & ends in the language, like e.g missing graphics commands
  • Make it produce independent applications, either by separating the VM from the IDE or by compiling to .exe (note: work already started)
Children & Education
  • A site "trykalimat.com" where users can type and run Kalimat programs directly in the web browser, to test the language without downloading.
  • A Youtube-like site where children can upload their programs for others to see (the idea comes from MIT Scratch) and a 'share' button in the IDE for automatic uploads
  • Integrated tutorials, labs and exercises in the IDE itself
  • Social ecosystem of books, online communities, training...etc
  • Programmable toys that have an interface to Kalimat...OOP with real physical objects!
  • Research and computational thinking
A professional language
  • Add more libraries, support for web applications, (perhaps also iPhone or Android applications)
  • Optional static type checking
  • A online repository for installing libraries and components from the IDE
  • Faster VM, better garbage collection, running concurrent processes in parallel
  • 'Sister' Compilers for the Java VM or .Net CLR
  • A book "Kalimat internals" to explain design & architecture behind Kalimat, to help contributors to the project, beginner compiler writers, and people who want to create their own Arabic PLs
  • Transform Kalimat from "Mohamed Samy's project" into "Kalimat team project"
Let's hope at least a significant portion of this is somehow accomplished, إن شاء الله.

الجمعة، 12 أغسطس 2011

فيديو: مواد كلية الحاسبات وأهميتها - حاسبات عين شمس نموذجاً

لا يتعدى هذا الفيديو 35 دقيقة لكنه غني جداً بالمعلومات عن المواد وأهميتها علمياً وبرمجياً وفي سوق العمل. قدمته في الكلية منذ فترة قريبة والآن هو على الإنترنت للجميع. مشاهدة ممتعة!

الslides المقدمة في الفيديو تجدها هنا

(لو أعجبك هذا البوست فقد يعجبك أيضاً هذا: حاسبات للقرن الواحد والعشرين)

مفاتيح للنهضة

ولا نظن أن هناك شعباً ما يستطيع أن يقضي على الأمة العربية والإسلامية مهما كانت المحاولات والحروب التي تواجهها الأمة، ولكن تخاذل الأمة عن دورها، وتقاعسها عن الفعل الحضاري المسئول، هو ما يمكن أن يقضي عليها.

فقوة الأمة من داخلها، كما أن ضعفها يأتي أساساً من داخلها، والعوامل الخارجية تمثل التحديات والعقبات كما تمثل الظروف والسياق العام الخارجي. ولكن هذه العوامل لا تهزم الأمة إن لم تكن في حالة ضعف، ولا تصد الأمة عن تحقيق النهوض الحضاري إذا تحقق للأمة إرادة النهوض الحقيقية


[من مقدمة كتاب "حضارة الوسط: نحو أصولية جديدة" للدكتور رفيق حبيب]

وذلك أنا لا نعلم شيئاً يبتغيه الناظم بنظمه غير أن ينظر في وجوه كل باب وفروقه‏.‏فينظر في الخبر إلى الوجوه التي تراها في قولك‏:‏ "زيد منطلق" و "زيد ينطلق" و"ينطلق زيد" و"منطلق زيد" و"زيد المنطلق" و"المنطلق زيد" و"زيد هو المنطلق" و"زيد هو منطلق‏".‏

وفي الشرط والجزاء إلى الوجوه التي تراها في قولك‏:‏ "إن تخرج أخرج" و"إن خرجتَ خرجتُ" و"إن تخرج فأنا خارج" و"أنا خارج إن خرجت" و"أنا إن خرجت خارج‏".‏

وفي الحال إلى الوجوه التي تراها في قولك‏:‏ "جاءني زيد مسرعاً" و"جاءني يسرع" و"جاءني وهو مسرع" (أو هو يسرع) و"جاءني قد أسرع" و"جاءني وقد أسرع‏".‏

فيعرف لكل من ذلك موضعه ويجيء به حيث ينبغي له‏.‏

[من كتاب "دلائل الإعجاز"، للعالم عبد القاهر الجرجاني]


Oppenheimer's way of working with his research students was also original. His group consisted of 8 or 10 graduate students and about half a dozen postdoctoral fellows. He met the group once a day in his office. A little before the appointed time, the members straggled in and and disposed themselves on the tables and about the walls.

Oppenheimer came in and discussed with one after another the status of the student's research problem while the others listened and offered comments. All were exposed to a broad range of topics. Oppenheimer was interested in everything; one subject after another was introduced and coexisted with all the others. In an afternoon they might discuss electrodynamics, cosmic rays, astrophysics and nuclear physics.

[.....] For each problem that interested him, Oppenheimer would select a student or postdoc to work out the details.

[from "Black holes and time warps" by Kip S. Thorne"]

الخميس، 11 أغسطس 2011

كلمات: استدعاء إجراءات سي

إمكانات كثيرة يريدها المبرمج: رسومات ثلاثية الأبعاد، مؤثرات صوتية، اتصال بالإنترنت، تعامل مع نظام التشغيل... حين اضفت إمكانيات الGUI كان لابد أن أغير المفسر interpreter، لأن مفسر كلمات كان حلقة الاتصال الوحيدة بين اللغة وبين العالم الخارجي. هل سيحدث نفس الشيء مع كل الإمكانيات الأخرى؟

لا ينبغي تغيير مفسر اللغة كل مرة يُحتاج فيها لإضافة إمكانية، لذلك كان لابد من تغيير هذا الوضع...

[ملاحظة هامة: لن تعمل هذه الأمثلة إلا على إصدار اغسطس 2011 أو أحدث. يمكنك تحميل أحدث إصدارة من هنا أو هنا].

كل اللغات المعروفة تقريباً فيها إمكانية التعامل مع الدوال الخارجية (Foreign function interface) أو FFI، وهذا في أغلب الأحيان يساوي إمكانية للتعامل مع مكتبات الربط DLL المكتوبة بالسي. هذه الإمكانية الآن موجودة في كلمات أيضاً. مثال بسيط على هذا؛ دالة MessageBox:
مكتبة "user32.dll" :

دالة رسالة برمز "MessageBoxW" ( مشير.سي،
نص.سي،
نص.سي،
صحيح32.سي ) صحيح32.سي
نهاية
م = رسالة ( 0 ، "هذه العملية سوف تدمر كل شيء!!"،
"هل أنت متأكد؟" ، 3 )

هذه أول مرة نرى فيها Type declarations في كلمات! نحن لا نستخدمها إلا في حالة الـFFI لكن من يدري؟ قد نراها مستقبلاً في أدوار أخرى...

لاحظ في المثال السابق أن نوع القيمة القيمة الراجعة من الدالة (وهو صحيح32.سي) مكتوب في آخر السطر المعرفة فيه الدالة نفسها. ماذا لو كنا نريد استدعاء void function؟ في تلك الحالة نعرف إجراء بدلا من دالة ولا نذكر القيمة الراجعة.

قبل أن نكمل هذا مرجع سريع لأنواع البيانات المستخدمة في التعامل مع إجراءات السي:
النوع في لغة سي
النوع في كلمات
int
صحيح32.سي
float
طفوي.سي
long
طويل.سي
double
مزدوج.سي
char
حرفي.سي
char *
نص.آسكي.سي
wchar_t *
نص.سي
void *
مشير.سي

لاحظ أن نص.آسكي.سي يعمل مع الحروف الانجليزية، بينما نص.سي يقبل حروف اليونيكود - ومنها الحروف العربية، والموضوع يعتمد بالطبع على نوع البيانات الذي تقبله الدالة: مثلاً في ويندوز الدالة MessageBoxA تستخدم آسكي بينما MessageBoxW تستخدم يونيكود.

ها هنا مثال آخر، لكن هذه المرة على نسخة كلمات على لينكس، يوضح استخدام دالة getenv:
مكتبة "libc.so.6" :

دالة بيئة برمز "getenv" ( نص.آسكي.سي ) نص.آسكي.سي
نهاية
م = بيئة ( "PATH" )
اطبع م
يحاول مفسر كلمات التصرف "بعقل" قدر الإمكان، فمثلاً قام بتحويل النص المقدم للدالة من يونيكود (وهو الصيغة الداخلية لكل نصوص كلمات) إلى آسكي قبل استدعاء الدالة. نفس الشيء يحدث لو كانت الدالة تريد قيمة عدد حقيقي وأرسل لها مثلاً عدد صحيح.

ماذا عن الدوال التي تأخد قيماً أعقد من integer أو نص؟ تعال نتخيل أن لدينا مكتبة DLL فيها دالة اسمها TestPoint تأخذ عاملاً بهذا الشكل:
struct POINT
{
long x; long y;
};

لا يمكن في تلك الحالة الاكتفاء بإرسال كائن بفصيلة مصنوعة بكلمات، لأن المفسر سيعجز عن معرفة طريقة نقل (أو تسيير، marshalling) كل بيان من كلمات إلى مكانه الصحيح في الذاكرة لتتمكن دالة السي من استخدامه.

هذا بسبب أن معلومات POINT موجودة لدى مترجم السي وحده، ولو أردنا استخدامها من كلمات سيكون علينا إعادة تعريف هذه المعلومات:
فصيلة نقطة :

له س تسييره طويل.سي
له ص تسييره طويل.سي
نهاية

مكتبة "simple_dll.dll" :
دالة اختبر.نقطة برمز "TestPoint" ( نقطة ) صحيح32.سي
نهاية

ن = نقطة جديد
س ن = 130
ص ن = 180
ذ = اختبر.نقطة ( ن )
اطبع ذ
هنا فصيلة نقطة هي فصيلة عادية جدا، فقط أضفنا معلومات عن كيفية استخدام قيم س، ص عند ارسال نقطة لدالة سي. يمكننا - إن أردنا - أن نضيف المزيد من الfields أو الmethods لفصيلتنا، ولكن عند تقديمها لدالة سي لن يتم التعامل إلا مع البيانات المعرف لها "تسيير".

هيا نكتب الآن مثالاً أطول يستخدم Windows API. سوف نكتب برنامجاً يرسم مستطيلاً أسوداً في منتصف الشاشة - في منتصف الشاشة الحقيقية وليس نافذة كلمات.

أولاً نكتب هذا البرنامج بلغة سي ثم "نترجمه" خطوة خطوة:
HDC dc = GetDC(0); // Retrieve device context of whole screen
HBRUSH brush = GetStockObject(BLACK_BRUSH);
RECT r;
r.left = 800;
r.top = 600;
r.right = 1000;
r.bottom = 700;
FillRect(dc, &r, brush);

يستخدم البرنامج هنا ثلاث دوال سي: GetDC، GetStockObject، FillRect

ويستخدم أيضاً نوع بيانات جديد هو RECT. فلنعرفه أولاً:
فصيلة مستطيل :

له يسار تسييره طويل.سي
له قمة تسييره طويل.سي
له يمين تسييره طويل.سي
له قاع تسييره طويل.سي
نهاية
الآن نعرف الدوال المطلوبة:
مكتبة "user32.dll" :

دالة مجال.رسم برمز "GetDC" ( مشير.سي ) مشير.سي
    دالة املأ.مستطيل برمز "FillRect" ( مشير.سي ، مشير ( مستطيل ) ، مشير.سي ) صحيح32.سي

نهاية

مكتبة "gdi32.dll" :
دالة عنصر.رسم.جاهز برمز "GetStockObject" ( صحيح32.سي ) مشير.سي
نهاية
لاحظ أننا في الدالة FillRect لا نرسل مستطيلاً، بل نرسل مشير pointer إلى مستطيل..وحين استدعينا الدالة في السي لم نرسل المستطيل r بل أرسلنا عنوانه في الذاكرة r&..سينعكس هذا على كود كلمات أيضاً.

لاحظ أيضاً أننا في الأنواع تحت صنف HANDLE مثل HDC أو HBRSUH نستخدم مشير.سي

(تسيير..مشير..لقد صارت اللغة سياسية أكثر من اللازم. الإصدارة القادمة لابد من أمر اسمه أجندة لتكتمل الصورة)

الآن نكتب برنامجنا:
ط = مستطيل جديد

يسار ط = 800
قمة ط = 600
يمين ط = 1000
قاع ط = 700

م = مجال.رسم ( 0 )
الفرشاة = عنصر.رسم.جاهز ( 4 )
املأ.مستطيل ( م ، عنوان ( ط ) ، الفرشاة )
عند تنفيذ البرنامج سوف يظهر مستطيل أسود على الشاشة. قد لا يظهر المستطيل كاملاً لو تقاطع مع نافذة البرنامج، لأن تلك النافذة ترسم نفسها باستمرار.

ليس أكثر عرض شيق في العالم، كما أن إمكانية FFI في صورتها الحالية لم تكتمل، ومليئة بالأخطاء، وتسبب memory leaks مثل المصفاة...لكن الكود، حتى في تلك الصورة، تثبت أننا نسير في الطريق الصحيح: لقد بدأت لغة كلمات تقترب من اللغات الإحترافية. من يدري ماذا يمكن أن يُعمل بها الآن..ربما يضيف أحد مكتبة تستخدم OpenGL.

أو ربما تتصل بقواعد بيانات. أو يصمم بها برامج شبكية. لا أدري - لقد صار الباب مفتوحاً لغيري الآن :)

الاثنين، 1 أغسطس 2011

أنت والمغالطات المنطقية

صار الحوار السياسي مزعجا هذه الأيام؛ أشبه بصورة كاريكاتيرية عبارة عن وجهين يصرخان في بعضهما.

هناك مغالطات منطقية يقع فيها العديد من الأطراف. في المجتمعات الغربية صارت المغالطات مصطلحات دارجة لها أسماء، وهناك كتالوجات بها. سأسرد في هذا المقال بعض هذه المغالطات الشهيرة ومحاولة لتعريب اسمائها وأمثلة لها.

لماذا أفعل ذلك؟
  • أولا ليراجع كل منا نفسه قبل أن يتحاور، ويلغي من كلامه الخاص كل حجة فيها مغالطة (ذلك على افتراض أن الشخص نفسه يسعى للمصداقية بالطبع)
  • ثانيا لمساعدة القاريء على تقييم مصداقية الأخبار والمقالات والحوارات التي يقرأها كل يوم، ويرى إن كانت مبنية على حجج سليمة أم فاسدة
  • ثالثاً، لكي يستعين به المحاور إن كان الطرف الآخر استخدم - بقصد أو غير قصد - مغالطة في كلامه
شيء أخير: لقد تعمدت أن أوجد مصطلحاً عربياً لكل مغالطة ليس من أجل فكرة عامة على غرار تعريب العلوم وما شابه ولكن من أجل هدف مختلف: لأني أريد أن تكون الأسماء نفسها دارجة؛ بحيث يمكن لشخصان يتحاوران أن يقول أحدهما مثلاً "حجتك فيها مغالطة لا يتبع" فيفهمه الآخر والجمهور فوراً بلا حاجة لشرح المغالطات كلها من البداية.

الآن نأتي للكتالوج...

اسم المغالطة: Ad-hominem
الاسم العربي: هجوم تجاه الشخص لا الحجة

هذه أشهر مغالطة موجودة في مجتمعنا حالياً، أن يأتي الخصم ويجد عيباً ما (يراه) في الطرف الآخر، وعليه يكون الاستنتاج أن الطرف الآخر على خطأ. المغالطة هنا واضحة: حتى لو كان خصمك شخصاً سيئاً في نظرك فهذا ليس رداً كافياً على حجته...وكل التخوين والاتهام والسخرية من الناس لا تجعلهم مخطئين في وجهة نظر ما بالذات ولو كانت الاتهامات صحيحة.

كيف تتصرف: نبه الطرف الآخر أنه بهجومه الشخصي عليك يحاول أن يفلت من الرد على حجتك، واطلب منه رداً محدداً على كلامك

اسم المغالطة: Strawman argument
الاسم العربي: استبدال حجة أسهل

هذه أيضاً ذائعة هذه الأيام؛ أن تفسر كلام خصمك تفسيراً ليس بالضبط ما قصده لكن شيئاً له علاقة ما بما قاله، ويكون شيء أسهل بكثير في الرد. مثلاً:

يقول طرف من الأطراف "أنا مع الحكم الإسلامي"
فيرد الطرف الآخر "هل تريد ولاية الفقيه مثل إيران؟؟؟؟"

الطرف الأول لم يقل هذا مطلقاً، لكن الطرف الثاني أراد أن يرد على شيء يسهل الرد عليه، ففسر كلام الأول تفسيراً مخطئاً بهدف التيسير على نفسه.

اسمها بالانجليزية "مغالطة رجل القش" تشبيها بشخص خاف من مواجهة رجل حقيقي فصنع رجلاً ضعيفا من القش وهزمه :)

كيف تتصرف: قل "كلامي لا يُستدلّ منه بالضرورة ما تقول، أنت فسرت كلامي بشكل خاطيء، وغيرت الموضوع إلى نقطة كذا بدلاً من معنى كلامي الأصلي".

اسم المغالطة: Non-sequiter
الاسم العربي: لا يتبع

هنا يقول المتحدث أنه هناك معلومة حقيقية (أ) ثم يستنتج منها نتيجة (ب)، مع أن ب ليست بالضرورة نتيجة منطقية تتبع أ

مثلاً:
- هناك تأخير في محاكمة مبارك، ومعنى ذلك أن المجلس العسكري متواطيء مع مبارك نفسه
- فلان سافر إلى أمريكا ويعمل في شركة أمريكية، إذاً هو عميل أمريكي
- تم تعيين فلان في لجنة كذا وهو من الإخوان المسلمين، إذاً المجلس العسكري متواطيء مع الإخوان

...وهكذا

اسم المغالطة: False dilemma
الاسم العربي: الاختيارات المزيفة، الزنقة الإجبارية

هنا يضع المتحدث أمامك بديلان أو أكثر ويجبرك أن تختار بينهما، بينما في الواقع هناك اختيارات أخرى لم يذكرها قد تخرج من "الزنقة" الي يحاول أن يضعك فيها.

مثلاً:
- "لماذا لم ترشح فلاناً؟ هل تريدها دولة علمانية؟"
- "كيف تترك الإسلاميين يفعلون ما يريدون؟ هل تريدها دولة كهنوتية؟"
- "لماذا تعارض إمساك أحمد شفيق بمنصب رئيس الوزراء؟ ألا تعلم أن البديل هو الفوضى؟"

كيف تتصرف: وضح أن الطرف الآخر صاغ كلامه بحيث لا يكون أمامك سوى هذه الاختيارات، اقترح بدائل أخرى إن أمكن.

اسم المغالطة: Appeal to emotions
الاسم العربي: اللجوء للعاطفة، التماس عاطفي

هنا يحاول الطرف الآخر أن يضع الموضوع في قالب عاطفي جداً لكي يطفيء أي ردود على كلامه، مثلاً:
- كيف لا تريد الانضمام للمسيرة من التحرير للعباسية؟ ألا تذكر دماء الشهداء؟ ألا تدرك معاناة أهلهم الذين لم يروا القصاص لأبنائهم؟
- لماذا تصر على محاكمة مبارك؟ انه رجل كبير في الثمانين وتعبان صحياً، كما أنه حارب وخدم الوطن..ارحموا الناس يا ناس!

اسم المغالطة: "Fallacy fallacy" (لا أعرف إن كان هذا اسماً رسمياً/دارجاً أم لا)
الاسم العربي: مغالطة "كلامك فيه مغالطة، إذن أنت على خطأ"

حين تجد مغالطة في كلام الطرف الآخر فليس معنى هذا أن رأيه الأصلي خطأ بالضرورة، فقط معناه أن هذه الحجة بالذات ليست دليلاً منطقياً على كلامه. قد يكون هناك أو لا يكون دليل آخر حقيقيّ. تذكر أن هدفنا هو المحافظة على مصداقية الحوار وليس "سحق" الخصم بأي وسيلة كانت ولو غير عادلة!

تذكر أيضاً أن المنطق ليس كل شيء أحياناً. مثلاً لو رأيت رجلاً متشح بالسواد ويمسك سكيناً ويسير ورائي، فهذا ليس دليلاً كافياً أنه سيء النية، لكن قد يكون من الحكمة أن أبتعد عنه :)

هذه كانت عينة من المغالطات المنطقية. ربما أستطيع أن أقدم المزيد من النماذج في مقال مستقبليّ.